Hi guys!
How I can retrieve "option value" info from select tag?
I am using this code, but it is only let me get "name".
I need to pass this value to second select tag.
I found this code here:
but they do not have any instructions how to retrieve option values.
----------JS------------
[HTML]<script>
function handleOnChange( dd1)
{
var idx = dd1.selectedInd ex;
var val = dd1[idx].text;
var par = document.forms["frmSelect"];
var parelmts = par.elements;
var prezsel = parelmts["prez"];
var course = val;
if (course != "-Select a Course-")
{
Http.get({
url: "./" + course + ".txt",
callback: fillPrez,
cache: Http.Cache.Get
}, [prezsel]);
}
}
function fillPrez(xmlrep ly, prezelmt)
{
if (xmlreply.statu s == Http.Status.OK)
{
var prezresponse = xmlreply.respon seText;
var prezar = prezresponse.sp lit("|");
prezelmt.length = 1;
prezelmt.length = prezar.length;
for (o=1; o < prezar.length; o++)
{
prezelmt[o].text = prezar[o];
}
}
else
{
alert("Cannot handle the AJAX call.");
}
}
</script>[/HTML]
------HTML----------
[HTML]<form name="courseSel ect">
<select name="course" onChange.value= "handleOnChange (this);">
<option value='0'>-Select a Course-</option>
<option value='1'>Cours e Name 1</option>
<option value='2'>Cours e Name 2</option>
<option value='3'>Cours e Name 3</option>
</select>
</form>
[/HTML]
Thank you
Sergey.
How I can retrieve "option value" info from select tag?
I am using this code, but it is only let me get "name".
I need to pass this value to second select tag.
I found this code here:
but they do not have any instructions how to retrieve option values.
----------JS------------
[HTML]<script>
function handleOnChange( dd1)
{
var idx = dd1.selectedInd ex;
var val = dd1[idx].text;
var par = document.forms["frmSelect"];
var parelmts = par.elements;
var prezsel = parelmts["prez"];
var course = val;
if (course != "-Select a Course-")
{
Http.get({
url: "./" + course + ".txt",
callback: fillPrez,
cache: Http.Cache.Get
}, [prezsel]);
}
}
function fillPrez(xmlrep ly, prezelmt)
{
if (xmlreply.statu s == Http.Status.OK)
{
var prezresponse = xmlreply.respon seText;
var prezar = prezresponse.sp lit("|");
prezelmt.length = 1;
prezelmt.length = prezar.length;
for (o=1; o < prezar.length; o++)
{
prezelmt[o].text = prezar[o];
}
}
else
{
alert("Cannot handle the AJAX call.");
}
}
</script>[/HTML]
------HTML----------
[HTML]<form name="courseSel ect">
<select name="course" onChange.value= "handleOnChange (this);">
<option value='0'>-Select a Course-</option>
<option value='1'>Cours e Name 1</option>
<option value='2'>Cours e Name 2</option>
<option value='3'>Cours e Name 3</option>
</select>
</form>
[/HTML]
Thank you
Sergey.
Comment