purplemonkey Posted July 18, 2006 Share Posted July 18, 2006 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 thisecho "<div class='menutitle' onclick='SwitchMenu('sub1')'>Site Menu</div>"then this wouldn't workplease help,I'm working on this code right now.cheers like Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted July 18, 2006 Share Posted July 18, 2006 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] Quote Link to comment Share on other sites More sharing options...
purplemonkey Posted July 18, 2006 Author Share Posted July 18, 2006 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 Quote Link to comment Share on other sites More sharing options...
Dville Posted July 18, 2006 Share Posted July 18, 2006 when I echo html code, that require double quotes, i just use a single quote Quote Link to comment Share on other sites More sharing options...
purplemonkey Posted July 18, 2006 Author Share Posted July 18, 2006 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. ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.