Invalid character in string reference

D

Dan McCloud

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?
 
L

Lee

Dan McCloud said:
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.
 
I

Ivan Marsh

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 ">"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top