javascript in event - unterminated string constant
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Greg_Adams
Posted On:   Saturday, April 1, 2006 04:39 AM

function foo(str1) { alert('foo, str1: ' + str1); } ]]>]]> I'm extremely new at Javascript, and I'm having some trouble figuring out why this is a problem: click me the causes a javascript error, unterminated string constant. Shouldn't the " be an escaped doublequote, hence not interpreted as the start of a new string? I've tried removing the escape on the doublequote and I still get the same error message in IE6. Incidentally, I've been able to use the following in a script block: var str = '" My string with a doublequote    More>>


I'm extremely new at Javascript, and I'm having some trouble figuring out why this is a problem:




			
				





click me








the causes a javascript error, unterminated string constant. Shouldn't the " be an escaped doublequote, hence not interpreted as the start of a new string? I've tried removing the escape on the doublequote and I still get the same error message in IE6.




Incidentally, I've been able to use the following in a script block:

			



this does not give the unterminated string constant error. This makes me think that the problem is due to the escaped doublequote in an HTML attribute.

Any ideas?    <<Less

Re: javascript in event - unterminated string constant

Posted By:   Axel_Richter  
Posted On:   Saturday, April 1, 2006 11:02 AM

About | Sitemap | Contact