getting to read the backslash 
Author Message
 getting to read the backslash

I am trying to split the username variable into two variables, separated at
the backslash. So domain goes into one variable and user goes into another.
But I am getting an untermintated string error where I am declaring
exp_array. It is reading the backslash as an escape character, i.e. it
thinks I am trying to escape the ending quote, but all I want is to enclose
the backslash within quotes. I tried to use single quotes and I get the same
message. If I do the following exp-array = user.split("\\"); I get object
does not support this property or method. Does any one how I can fix this?

var username = "domain\user";
var exp_array = user.split("\");
var domainloc = exp_array[0];
var login = exp_array[1];

document.write(exp_array[0] +" "+exp_array[1]);



Tue, 12 Nov 2002 03:00:00 GMT  
 getting to read the backslash

You have syntax errors on lines 1 and 2. Line 1 contains an unescaped
backslash and line 2 contains an unescaped backslash and an undeclared
variable. What you meant was:

var username = "domain\\user";
var exp_array = username.split("\\");


: I am trying to split the username variable into two variables,
separated at
: the backslash. So domain goes into one variable and user goes into
another.
: But I am getting an untermintated string error where I am declaring
: exp_array. It is reading the backslash as an escape character, i.e.
it
: thinks I am trying to escape the ending quote, but all I want is to
enclose
: the backslash within quotes. I tried to use single quotes and I get
the same
: message. If I do the following exp-array = user.split("\\"); I get
object
: does not support this property or method. Does any one how I can fix
this?
:
: var username = "domain\user";
: var exp_array = user.split("\");
: var domainloc = exp_array[0];
: var login = exp_array[1];
:
: document.write(exp_array[0] +" "+exp_array[1]);
:
:
:



Tue, 12 Nov 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Reading registry values containing a backslash (\)

2. Getting VB Script to read text from screen

3. Getting Javascript to read a textfile into a string

4. Getting Javascript to read a textfile into a string

5. Cookie not getting read properly...why?

6. Getting garbage when reading from the textfile

7. script Reads directory and gets permission denied

8. Stop backslash behaving as the escape character

9. Backslash disapears

10. Backslash problems - help!

11. How to print backslash?

12. double backslashes

 

 
Powered by phpBB® Forum Software