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
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>";

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.