Jump to content

call javaxcript from within php


clausowitz

Recommended Posts

What about this?

I can't get it right with the quotes:

<?php if (isset($_SESSION['idx'])) {      
echo '<div class="containerheader" id="titleTextImg"><strong>Military Attachés accredited in Egypt</strong>';
echo '<a id="imageDivLink8" href="javascript:toggle5("contentDivImg8", "imageDivLink8");"><img src="images/x.gif" align="right"></a></div>';
echo '<div class="container" id="contentDivImg8" style="font-size:15px; display:block; margin-bottom:5px;">
        <a href="member_countries.php"><img src="images/worldmap.gif" width="300" height="184" alt="Member Countries" title="Member Countries" border="0" /></a>
        <br /><span style="font-size:12px;">Click somewhere on the map to open the member countries page.</span></div><br />';}
      ?>  

Link to comment
Share on other sites

My personal preference, which I've found to be easier is to surround echo strings with double quotes, and then attributes within those strings with single quotes.  Only when working with Javascript inside those strings will I use escaped double quotes (\") around the outside.

 

<?php if (isset($_SESSION['idx'])) {      
echo "<div class='containerheader' id='titleTextImg'><strong>Military Attachés accredited in Egypt</strong>";
echo "<a id='imageDivLink8' href=\"javascript:toggle5('contentDivImg8', 'imageDivLink8');\"><img src='images/x.gif' align='right'></a></div>";
echo "<div class='container' id='contentDivImg8' style='font-size:15px; display:block; margin-bottom:5px;'>
        <a href='member_countries.php'><img src='images/worldmap.gif' width='300' height='184' alt='Member Countries' title='Member Countries' border='0' /></a>
        <br /><span style='font-size:12px;'>Click somewhere on the map to open the member countries page.</span></div><br />";}
      ?>  

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.