N
.nLL
Hi, i ma trying to change a dropdown box index to mathing value of on
another dropdown box in same form. here is the form
--------------------------------------------------------------------------------------------------------------------------
<form method="post" name="myform" action="default.asp">
<p>
Select Month:
<select name="mymonth"
onChange="document.getElementById('myday').selectedIndex=0">
<option value="20080401" selected="selected" >April-2008 (26158)</option>
<option value="20080301" >March-2008 (2)</option>
<option value="20080201" >February-2008 (1)</option>
</select>
Day:
<select name="myday" >
<option value="0" >All days</option>
<option value="20080401" >1-Tuesday (1)</option>
<option value="20080420" >20-Sunday (2)</option>
<option value="20080421" >21-Monday (1)</option>
<option value="20080425" selected="selected">25-Friday (26154)</option>
</select>
<input type="submit" value="View"/>
</p>
</form>
-------------------------------------------------------------------------------------------------------------------------------------------
when mymonth changes scipt sets myday seleceted index to 0 (ALL days)
and hits submits, data from that month comes but user can first select month
then change day on myday selectbox and hit submit. that would bring wrong
data. so i am trying to prevent that
by changing mymonth data to matching value of myday onchange vent on myday
mymnth value always unique and myday data always incremental (as in
20080401,20080402,20080403)
you would notice myday value has 2 more characters than mymonth data but to
sort this problem out i've got below function
-------------------------------------------------------
function Left(str, n)
{
if (n <= 0) // Invalid bound, return blank string
return "";
else if (n > String(str).length) // Invalid bound, return
return str; // entire string
else // Valid bound, return appropriate substring
return String(str).substring(0,n);
}
--------------------------------------------------------------------------------------------------
so, how can i do it?
select name="myday"
onChange="document.getElementById('mymonth').selectedIndex=?????????????????????????????????">
can anyone give me a clue?
thanks
another dropdown box in same form. here is the form
--------------------------------------------------------------------------------------------------------------------------
<form method="post" name="myform" action="default.asp">
<p>
Select Month:
<select name="mymonth"
onChange="document.getElementById('myday').selectedIndex=0">
<option value="20080401" selected="selected" >April-2008 (26158)</option>
<option value="20080301" >March-2008 (2)</option>
<option value="20080201" >February-2008 (1)</option>
</select>
Day:
<select name="myday" >
<option value="0" >All days</option>
<option value="20080401" >1-Tuesday (1)</option>
<option value="20080420" >20-Sunday (2)</option>
<option value="20080421" >21-Monday (1)</option>
<option value="20080425" selected="selected">25-Friday (26154)</option>
</select>
<input type="submit" value="View"/>
</p>
</form>
-------------------------------------------------------------------------------------------------------------------------------------------
when mymonth changes scipt sets myday seleceted index to 0 (ALL days)
and hits submits, data from that month comes but user can first select month
then change day on myday selectbox and hit submit. that would bring wrong
data. so i am trying to prevent that
by changing mymonth data to matching value of myday onchange vent on myday
mymnth value always unique and myday data always incremental (as in
20080401,20080402,20080403)
you would notice myday value has 2 more characters than mymonth data but to
sort this problem out i've got below function
-------------------------------------------------------
function Left(str, n)
{
if (n <= 0) // Invalid bound, return blank string
return "";
else if (n > String(str).length) // Invalid bound, return
return str; // entire string
else // Valid bound, return appropriate substring
return String(str).substring(0,n);
}
--------------------------------------------------------------------------------------------------
so, how can i do it?
select name="myday"
onChange="document.getElementById('mymonth').selectedIndex=?????????????????????????????????">
can anyone give me a clue?
thanks