Calling Javascript - Window.open in PHP -


i'm trying call window.open() javascript code inside php file, unfortunately not responding.

here's code:

<html> <head> <script language="javascript"></script> </head> <body>  <?php .....  $printheader .= " <div id ='subheader'><p class = 'alignleft'><font style='color:blue'>user: " . $username . " | access: " . $level ." | <a href=logout.php>logout</a></font></p>";   $printheader .= " <p class='alignright'><a href='refresh.php' onclick='window.open(this.href,'mywin','width=400,height=200')'>refresh list</a></p></div>";  $printheader .= "<div style='clear: both;'></div>";  .... ?>  </body> </html> 

unfortunately, when run it, doesn't work @ all. can not call javascript in php? please advise!

thanks!

i think issue related quotes, inner single quotes ending onclick string, replacing outter single quotes double quotes(will keeping inner quotes single) solve issue. try changing this:

onclick='window.open(this.href,'mywin','width=400,height=200)'   

to this:

onclick=\"window.open(this.href,'mywin','width=400,height=200)\"   

here's example:

on jsfiddle

another solution escape inner quotes prefixing them backslash (\).


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -