Web Analytics Made Easy -
StatCounter javascript popup embedded in php not working?? - CodingForum

Announcement

Collapse
No announcement yet.

javascript popup embedded in php not working??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • javascript popup embedded in php not working??

    I have a php script with a javascript popup embedded.

    here's the source for the included file:


    PHP Code:
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function 
    MM_openBrWindow(theURL,winName,features) { //v2.0
      
    window.open(theURL,winName,features);
    }
    //-->
    </script
    here's the javascript as it appears in the file embeded within php tags
    PHP Code:
    <?
    for ($i=0$i<$data$i++)
    {
    echo 
    "<td width='60'><a href='javascript:;' onClick='MM_openBrWindow('e".($i+1).".php','','width=347,height=525')'><img src='uploads/$SI_result[$i]' width='54' height='76' border=\"0\"></a></td>";}
    ?>
    here's the code how it appears when source is viewed from a web page:

    PHP Code:
    <td width='60'><a href='javascript:;' onClick='MM_openBrWindow('e1.php','','width=347,height=525')'><img src='uploads/etruria01_sm.jpg' width='54' height='76' border="0"></a></td
    why doesn't my popup work?

    thanks

  • #2
    because of nested single quotes
    why not use double quotes for attribute values?

    echo "<td width=\"60\"><a ... onClick=\"MM_openBrWindow('e".($i+1).".php','','width=347,height=525')\"> ... ";}
    Glenn
    vBulletin Mods That Rock!

    Comment


    • #3
      thanks Glenn

      your code worked

      here's the code

      PHP Code:
      echo "<td width=\"60\"><a href=\"javascript:;\"onClick=\"MM_openBrWindow('e".($i+1).".php','','width=347,height=525')\"><img src='uploads/$SI_result[$i]' width='54' height='76' border=\"0\"></a></td>"

      Thanks again

      Comment

      Working...
      X