HighTechTalks DotNet Forums  

string function split does not work in the external js file

Dotnet Scripting microsoft.public.dotnet.scripting


Discuss string function split does not work in the external js file in the Dotnet Scripting forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Akhtar Hussain Shar
 
Posts: n/a

Default string function split does not work in the external js file - 03-17-2005 , 06:49 AM






Hi Guys,
I am using javascript for string splitting, it works fine, when I use that
code in the html file, but when I create external js file, and use external
file. All other script (including alert, loops,....) works fine except split
function, any idea, following is the code.
var box = document.Form1.lstAddresses;
alert(box.options[box.selectedIndex].value);
var destination = box.options[box.selectedIndex].value;
var myAddress = destination.split("¬");
alert(myAddress[2]);
alert(myAddress[3]);
alert(myAddress[4]);
alert(myAddress[5]);
document.Form1.txtHouseNo.value = myAddress[1];
regards and thanks
Akhtar Hussain

Reply With Quote
  #2  
Old   
Akhtar Hussain Shar
 
Posts: n/a

Default Re: string function split does not work in the external js file - 04-01-2005 , 02:33 AM






If I use other delimeters, I do not have any problem. But I want to use "¬"
as a spilt delimeter, because I have junk data, whcih
cntains(,.:;#~!"£$%^&*()) almost all other data. I want to know is there any
way to use UTF-8 format. If yes, could you send me with an example.
regards,
Akhtar Hussain


"Robbe Morris [C# MVP]" wrote:

Quote:
I use split in .js files and it works properly. You've got something
else going on here but I don't see a problem with your
code. The array is zero based so the first
element should be myAddress[0];

Do you have these same problems with a different
delimiter?

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx



"Akhtar Hussain Shar" <Akhtar Hussain Shar (AT) discussions (DOT) microsoft.com> wrote
in message news:74810690-93A7-46C1-A27C-9B9891BD1815 (AT) microsoft (DOT) com...
Hi Guys,
I am using javascript for string splitting, it works fine, when I use
that
code in the html file, but when I create external js file, and use
external
file. All other script (including alert, loops,....) works fine except
split
function, any idea, following is the code.
var box = document.Form1.lstAddresses;
alert(box.options[box.selectedIndex].value);
var destination = box.options[box.selectedIndex].value;
var myAddress = destination.split("¬");
alert(myAddress[2]);
alert(myAddress[3]);
alert(myAddress[4]);
alert(myAddress[5]);
document.Form1.txtHouseNo.value = myAddress[1];
regards and thanks
Akhtar Hussain




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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.