Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spliting string value into list box

Status
Not open for further replies.

ejg

Programmer
Aug 17, 2001
19
US
Hi All,

I am trying to use the split function to split a string into an array. I then need the array to appear in a list box.

I have the user type a value (\n delimited), I have the split function split the string into an array. I then want the contents of this array to be displayed in a listbox.

The way that I am trying to split the string is as follows;

<form name=&quot;eventform&quot;><textarea rows=&quot;2&quot; name=&quot;S1&quot; cols=&quot;20&quot;></textarea>
<script>
var pubishArray = document.eventform.S1.value.split('\n')
</script>

any help or suggestions would be great!

-ejg
 
IF there is a Split function in JavaScript, wouldn't it be
var pubishArray = Split(document.eventform.S1.value,'\n')
in VBScript it would be
pubishArray = Split(document.eventform.S1.value,Chr(13) & chr(10))

The way you have it written
pubishArray = document.eventform.S1.value.split
says that Split is a method of value. I've never seen that in DHTML.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top