Jump to content

echo Java Pop-up in PHP....


pmoore

Recommended Posts

I'm a complete newb.  I'm trying to pop-up a tell a friend script, here's the block:

 

echo "<td valign=\"center\">";
         echo "<div style='width:100%; height:100%; vertical-align: center;'>";

           echo "<a href=\"javascript:newWindow('sendemail.php?'+document.location.href,'email',400,300,'') 'style=display: block;'>";

             echo "<span>";
               echo "<img src=\"".$mosConfig_live_site."/components/com_marketplace/images/system/writead.gif\" border=\"0\" align=\"top\" >";
             echo "</span>";
		 echo "   ";

             echo "<span>";
               echo JOO_TELL_FRIEND;
             echo "</span>";

           echo "</a>";
         echo "</div>";
       echo "</td>";

 

Here's the result:

 

screen1.png

 

The link appears, but when I click on it nothing happens and Firebug says:

missing ; before statement

newWindow('sendemail.php?'+document.location.href,'email',400,300,'') 'style=dis...

 

Also, the image doesn't appear in front of it.

 

I really appreciate any help!

Link to comment
https://forums.phpfreaks.com/topic/108567-echo-java-pop-up-in-php/
Share on other sites

Well, it's a JavaScript error because the PHP is not formatted correctly (By the way it is Javascript not Java).

 

The problem is onthis line

echo "<a href=\"javascript:newWindow('sendemail.php?'+document.location.href,'email',400,300,'') 'style=display: block;'>";

 

Try this:

<?php

echo "<td valign=\"center\">";
echo "<div style='width:100%; height:100%; vertical-align: center;'>";
echo   "<a href=\"javascript:newWindow('sendemail.php?'+document.location.href,'email',400,300,'')\; style=\"display: block;\">";
echo     "<span>";
echo       "<img src=\"".$mosConfig_live_site."/components/com_marketplace/images/system/writead.gif\" border=\"0\" align=\"top\" >";
echo     "</span>";
echo     "   ";
echo     "<span>" . JOO_TELL_FRIEND . "</span>";
echo   "</a>";
echo "</div>";
echo "</td>";

?>

I forgot the double quote after that slash before the style attribute.

 

All you need to do is LOOK at the HTML in the generated page and see where the error is. Use whatever debugging info you have (Firebug, IE, etc) and figure out what wasn't properly formatted and fix it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.