Invalid character in string reference

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dan McCloud

    #1

    Invalid character in string reference

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

    document.frmSte p1.drpInvaddres s.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?
  • Ivan Marsh

    #2
    Re: Invalid character in string reference

    On Wed, 26 May 2004 13:06:10 -0700, Dan McCloud wrote:
    [color=blue]
    > Is there anything 'wrong' with setting the value of a drop down menu using
    > the following?
    >
    > document.frmSte p1.drpInvaddres s.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?[/color]

    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.

    Comment

    • Lee

      #3
      Re: Invalid character in string reference

      Dan McCloud said:[color=blue]
      >
      >Is there anything 'wrong' with setting the value of a drop down menu
      >using the following?
      >
      >document.frmSt ep1.drpInvaddre ss.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?[/color]

      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.

      Comment

      Working...