Jump to content


Photo

help with "


  • Please log in to reply
4 replies to this topic

#1 purplemonkey

purplemonkey
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 18 July 2006 - 10:12 PM

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


#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 18 July 2006 - 10:15 PM

Either:

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

or

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


#3 purplemonkey

purplemonkey
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 18 July 2006 - 10:21 PM

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

#4 Dville

Dville
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 18 July 2006 - 10:29 PM

when I echo html code, that require double quotes, i just use a single quote

#5 purplemonkey

purplemonkey
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 18 July 2006 - 10:36 PM

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. ;)






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users