onMouseOver / onMouseOut event Javascript

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
spitfire_esquive
Forum Commoner
Posts: 37
Joined: Sun Nov 06, 2005 6:46 am

onMouseOver / onMouseOut event Javascript

Post by spitfire_esquive »

hello guys, happy new year!

i just wanted to know how to include the onMouseOver event (Javascript) in this PHP script I made considering the fact that in the echo statement of PHP you have to enclose the succeeding statement with a double quotation (")

Code: Select all

echo "<td>";
how can I insert

Code: Select all

td align="center" bgcolor="#0000ff" onMouseOver="this.bgColor='#ff0000'" onMouseOut="this.bgColor='#0000ff'"
i am confused on how the quotes and double quotes work in this case.

sorry for the stupid question.

thanks!
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Escape them using backslashes...

Code: Select all

echo "<td align=\"center\" bgcolor=\"#0000ff\" onMouseOver=\"this.bgColor='#ff0000'\" onMouseOut=\"this.bgColor='#0000ff'\">";
If a quote inside a string is the same as the quote that opened the string it must be preceded by a backslash :)
spitfire_esquive
Forum Commoner
Posts: 37
Joined: Sun Nov 06, 2005 6:46 am

Post by spitfire_esquive »

thank you very much! escapes!
Post Reply