Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coding for an "OnClick" event

Status
Not open for further replies.

JMay0816

Programmer
Mar 1, 2007
34
US
I am trying to code an image file for an onclick event. It works outside of the php coding but not inside:

This works:
<td width="3%" align="center">
<img src="Images/archive.gif" alt="View Revision History" border="0" onclick="MM_showHideLayers('RA','','show')"/> </td>

This doesn't:
<?php
echo "&nbsp;&nbsp;<img src='Images/request.gif' border='0' alt='Request Access' onclick='MM_showHideLayers('RA','','show')' />";
?>

is it the quotes?
 
Trying to output JavaScript code from PHP can be troublesome because getting all the nested quotes can be a pain. Try the HEREDOC syntax:

Code:
<?php
print <<< EOL
  &nbsp;&nbsp;<img src="Images/request.gif" border="0" alt="Request Access" onclick="MM_showHideLayers('RA','','show')"/>
EOL;
?>



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top