executing javascript popup in html <a> tag that are echo-ed in php -


the flow is: php page calls ajax function displays list of user in table without refreshing pages. in table, put delete , edit link. have no problem delete link however, i'm stuck @ edit link.

what i'm trying is, when user click edit link, there appear popup window, there, can update details of user, appears popup window not appearing.

the javascript function is:

<script type="text/javascript"> function newwindow(url) {  var x,y; x = screen.width-35; y = screen.height-30; var win =       window.open(url,'glossarywindow','toolbar=no,directories=no,width=500,height=500'+         'screenx=0,screeny=0,top=0,left=0,location=no,status=no,scrollbars=no,resize=yes,menubar=no');     } 

i put function @ top of page.

this php code call java function in html tag

echo "<td>" . '<a href="javascript: newwindow("/test/htmlpages/popup_update_user.html")">edit</a>' . "</td>"; 

is possible??

i checked url wrong, not problem. popup not appear @ all. need advise on matter.

update:

this correct code calling javascript in tag within php:

 <?php     echo "<td>" . "<a href=\"#\" onclick=\"newwindow('popup_update_user.html')\">edit</a>". "</td>"; ?> 

:d

the problem in echo opening , closing statement before calling javascript function.

and don't call function in "href", call "onclick".

try this:

echo "<td> <a href=\"#\" onclick=\"newwindow('/test/htmlpages/popup_update_user.html')\">edit</a></td>"; 

edit: working example

<!doctype html> <html>     <head>         <script type="text/javascript">             function newwindow(url) {              var x,y;             x = screen.width-35;             y = screen.height-30;             var win =       window.open(url,'glossarywindow','toolbar=no,directories=no,width=500,height=500'+                     'screenx=0,screeny=0,top=0,left=0,location=no,status=no,scrollbars=no,resize=yes,menubar=no');                 }     </script>     </head>     <body>         <table>             <tr>                 <?php                 echo "<td> <a href=\"#\" onclick=\"newwindow('/test/htmlpages/popup_update_user.html')\">edit</a></td>";                 ?>             </tr>         </table>     </body> </html> 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -