Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Development

dynamic array

Author Message
jonbrown



Joined: 01 Jul 2005
Posts: 56
Location: Silver Spring

Posted: Mon Aug 28, 2006 - 10:06 pm    Post subject: dynamic array Reply with quote

I have a script that executes based upon an array, the code

this.values = new Array(380,150,260,310,430);

is fine and works well however the array is static, and it can not be changed dynamically. What I have is this...

<input value="380,150,260,310,430" id="variables">

this.values = new Array(document.getElementById('variables').value);

the script does not work however, and need help assigning the array for this.values of the input.value which does change dynamically, so im hoping by changing the array based upon an input i can create some dynamic output.

Any help is appreciated!
View user's profile Send private message Send e-mail Visit poster's website Widgets
galendw



Joined: 30 May 2005
Posts: 71
Location: Here.

Posted: Tue Aug 29, 2006 - 5:58 pm    Post subject: Reply with quote

Hi Jon,

What I would do here is simply use the split() method.

Code:
document.getElementById('variables').value.split(",");


This will return an array or the values separated by a comma. This will also remove the comma from the values. More info on the split() method can be found here.

Best,
Galen D. W.
_________________
View user's profile Send private message Send e-mail Visit poster's website Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group