HighDots Forums  

Invalid character in string reference

Javascript JavaScript language (comp.lang.javascript)


Discuss Invalid character in string reference in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dan McCloud
 
Posts: n/a

Default Invalid character in string reference - 05-26-2004 , 04:06 PM






Is there anything 'wrong' with setting the value of a drop down menu
using the following?

document.frmStep1.drpInvaddress.value = 'A1020761603!>\>R2'

This string is a key in our database that I have no control over and I
want to set the value of the menu according to this value because it
is unique. I suspect that the '\' or the '>' or the '!' is making
Javascript think that this is a different type of data than string.

Is there a way to 'force' Javascript to interpret this as string?

Reply With Quote
  #2  
Old   
Lee
 
Posts: n/a

Default Re: Invalid character in string reference - 05-26-2004 , 04:24 PM






Dan McCloud said:
Quote:
Is there anything 'wrong' with setting the value of a drop down menu
using the following?

document.frmStep1.drpInvaddress.value = 'A1020761603!>\>R2'

This string is a key in our database that I have no control over and I
want to set the value of the menu according to this value because it
is unique. I suspect that the '\' or the '>' or the '!' is making
Javascript think that this is a different type of data than string.

Is there a way to 'force' Javascript to interpret this as string?
It's interpreting it as a string, but the '\' character is the
escape character in string literals. You must insert a second
backslash before it, if you want it to appear in the string value.



Reply With Quote
  #3  
Old   
Ivan Marsh
 
Posts: n/a

Default Re: Invalid character in string reference - 05-26-2004 , 04:39 PM



On Wed, 26 May 2004 13:06:10 -0700, Dan McCloud wrote:

Quote:
Is there anything 'wrong' with setting the value of a drop down menu using
the following?

document.frmStep1.drpInvaddress.value = 'A1020761603!>\>R2'

This string is a key in our database that I have no control over and I
want to set the value of the menu according to this value because it is
unique. I suspect that the '\' or the '>' or the '!' is making Javascript
think that this is a different type of data than string.

Is there a way to 'force' Javascript to interpret this as string?
Shouldn't that be: 'A1020761603!>\\>R2'

or are you escaping the second ">"?

--
i.m.
The USA Patriot Act is the most unpatriotic act in American history.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.