...

View Full Version : Error in JavaScript



The Infection
12-28-2010, 11:58 PM
I was working on this script to change text with javascript and I ran into a problem. The code goes like this:



<area shape="rect" coords="128,174,256,203" href="#" onClick="document.getElementById('content').innerHTML='<p class=first>Welcome to the first release of my


Now every time I use an apostrophe in a word then when I click the link that corresponds to that writing, it doesn't do anything. Here's the link to my website: http://bittipiilo.com/msx/
By default you are on the Home tab. Then when you click either Gallery or Services and try to go back to Home, nothing happens. Can someone help me?

Old Pedant
12-29-2010, 12:06 AM
To put an apostrophe inside of a string delimited by apostrophes, use \'

To put a quote inside of a string delimited by quotes, use \"



var a = 'I\'m here!';
var b = "He said, \"I'm here!\"";

It never hurts to use the \' or \" if you aren't sure:

var c = "I\'m here!";
var d = 'He said, \"I'm here!\"';

The Infection
12-29-2010, 03:33 PM
Thank you so much. That's been bothering me for quite some time.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum