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 />';}
      ?>  

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 />";}
      ?>  

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.