Schteeve
03-16-2009, 01:06 PM
Hi all,
I am trying to accomplish a fairly basic task with javascript > my lack of Js knowledge has meant i have hit something of a roadblock.
I need the a function to take an array from a form, remove the parsed variable from it and repost the form with the new array.
This is what I have so far...
<script language="javascript">
function remove(SID) {
var speakers = document.form_name.elements["SID[]"];
var new_speakers = array();
for(i=0;i<speakers.length;i++)
{
if( speakers[i].value !== SID) {
new_speakers[] = speakers[i].value;
}
}
document.form_name.SID.value=(new_speakers);
document.form_name.submit();
}
</script>
Please let me know if this is possible and if I'm on the right path.
Any help is very much appreciated!!
Thanks
Steve
I am trying to accomplish a fairly basic task with javascript > my lack of Js knowledge has meant i have hit something of a roadblock.
I need the a function to take an array from a form, remove the parsed variable from it and repost the form with the new array.
This is what I have so far...
<script language="javascript">
function remove(SID) {
var speakers = document.form_name.elements["SID[]"];
var new_speakers = array();
for(i=0;i<speakers.length;i++)
{
if( speakers[i].value !== SID) {
new_speakers[] = speakers[i].value;
}
}
document.form_name.SID.value=(new_speakers);
document.form_name.submit();
}
</script>
Please let me know if this is possible and if I'm on the right path.
Any help is very much appreciated!!
Thanks
Steve