473,386 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Javascript Split problem

20
Hi, I have written a code to split the string and here is the code.

Expand|Select|Wrap|Line Numbers
  1.    var myString = (str);
  2.        var myTemp1 = myString[11].split(",",1);
  3.        var myTemp2 = new Array();
  4.        myTemp2 = myTemp1.split("=",2);    
  5.         var myManager = myTemp2[1];
  6.  
I managed to get the value from myTemp1(tried it) but i have problem with
Expand|Select|Wrap|Line Numbers
  1. myTemp2 = myTemp1.split("=",2);    
  2.  
In FireFox Error Console show the error message :
Error: myTemp1.split is not a function.

Why the browser treat it as function? Please advice.

Thank you
Jan 9 '08 #1
3 6147
acoder
16,027 Expert Mod 8TB
myTemp1 is an array, not a string. Use an index into the array and then call split() on that.
Jan 9 '08 #2
DannyMc
20
Thank you for the solution, it works!

I thought myTemp1 supposed to be string, because i only assigned 1 variable to it. How come it is still array?
Jan 11 '08 #3
acoder
16,027 Expert Mod 8TB
I thought myTemp1 supposed to be string, because i only assigned 1 variable to it. How come it is still array?
split() produces an array from a string, not an array. It's not still an array. myString[11] is a string. If you call split() on that string, the result is an array.
Jan 11 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Kevin Newman | last post by:
I've been toying with a namespace manager, and wanted to get some input. So what do you think? if (typeof com == 'undefined') var com = {}; if (!com.unFocus) com.unFocus = {}; ...
4
by: Adam Smith | last post by:
Hello, How can I call or trigger an external javascript twice in a form? I have <script language="JavaScript" src="country_state.js" name="Country_State"> <script type="text/javascript"...
2
by: Yorian | last post by:
Hi, Another problem another question (as usual). I want to retrieve data through ajax, within the data there is some javascript which needs to be used (I figured that one out using eval ())....
3
by: modeep | last post by:
I have written some code to create a table using javscript it works fine in firefox but does not show the table in IE6 // JavaScript Document var easy =...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
22
by: giordan | last post by:
Hi all! I've wrote this code: <script type="text/javascript"> var largImg; var altImg; var txtTop = '<b>Ottima scelta!</b> Ora compila il form e premi "Ricevi banner". Il...
1
by: critchey1 | last post by:
Hey everyone, i've been playing around with trying to get some scripts to work with detecting whether flash player is installed on your computer or not. I found a flash detection kit on the adobe...
16
by: drwyness | last post by:
Hello, Please help with the following problem it is causing me some headaches. The following javascript code is designed to fill in text boxes with numbers on an online game (tribalwars). It...
2
by: joelkeepup | last post by:
Hi, I made a change this morning and now im getting an error that says either "a is undefined or null" or "e is undefined or null" the microsoft ajax line is below, I have no idea how to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.