Jump to content

Archived

This topic is now archived and is closed to further replies.

purplemonkey

help with "

Recommended Posts

how are you suposed to use a " in a line of code?

example
<div class="menutitle" onclick="SwitchMenu('sub1')">Site Menu</div>

in PHP would be
echo "<div class="menutitle" onclick="SwitchMenu('sub1')">Site Menu</div>"
and this would be invalid.

but if I did this
echo "<div class='menutitle' onclick='SwitchMenu('sub1')'>Site Menu</div>"
then this wouldn't work

please help,I'm working on this code right now.
cheers like

Share this post


Link to post
Share on other sites
Either:

[code]echo "<div class=\"menutitle\" onclick=\"SwitchMenu('sub1')\">Site Menu</div>";[/code]

or

[code]echo '<div class="menutitle" onclick="SwitchMenu(\'sub1\')">Site Menu</div>';[/code]

Share this post


Link to post
Share on other sites
thats fantastic thank you.  ::) it also explains why my editor keeps putting those \'s in when I type ". Was really winding me up that, I had to keep deleting them :D  :D

Share this post


Link to post
Share on other sites
when I echo html code, that require double quotes, i just use a single quote

Share this post


Link to post
Share on other sites
think the whole " vs '  was a bit of a red herin, I just noticed that one of my call variables had a case difference, I sorted that, and now everything works as should. Well at least I learnt something new.

thank for the aid. ;)

Share this post


Link to post
Share on other sites

×

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.