Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript syntax question

Status
Not open for further replies.

developer155

Programmer
Jan 21, 2004
512
US
Hi, I have a div in my page
<div id='Dislcaimer'></div>

And then I try to set its text like this at the end of page:
<script language=javascript>document.getElementById('Disclaimer').innerHTML="FirstName: Mike | LastName: Lamers | Address1: 360 N. Michigan | Address2: Suite 1900 | : Chicago | : IL | : 60601 | : test@c.s.1423248649 | <a href="#formstart" onClick='ShowHiddenFields()'>Edit </a>"</script>

I get invalid charatcer error. What could be the issue here?
 
You should escape the double quotes inside the string you're inserting into the innerHTML.
Code:
<a href=[b][red]\[/red][/b]"#formstart[b][red]\[/red][/b]" onClick='ShowHiddenFields()'>

Lee
 
Since this is a Javascript syntax question, another thing you should do is define your script tags like this:

Code:
<script type="text/javascript">

That is the XHTML1.0 corrrrrrrrrrrrrect way.

[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top