N
.nLL
got below script, works fine with IE but fails on opera. my js knowledge is
very limited and can't find whats wrong with it.
----------------------------------------------
function selectMatching(x)
{
var S = document.getElementById("mymonth");
var L = S.options.length;
for (var i=0; i <= L-1; i++)
{
if ((String(x.value).substring(0,6)) ==
String(S.options.value).substring(0,6)) {S.selectedIndex=i};
}
}
-------------------------------------
and i use it in below 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 (25299)</option>
<option value="20080301" >March-2008 (2)</option>
<option value="20080201" >February-2008 (1)</option>
</select>
Day: <select name="myday" onChange="selectMatching(this);">
<option value="0" selected="selected">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" >25-Friday (25293)</option>
<option value="20080427" >27-Sunday (2)</option>
</select>
<input type="submit" value="View"/>
</p>
</form>
---------------------------------------------------
what i do is. if user selects from months menu script resets days menu to
all days (doesn't work on opera)
if user changes days menu function finds matching month from the first list
and selects it. Although days has 2 more numbers ad the end by substring i
cut that part.
can anyone offer another solution that would work on opera too without
changing current form and its values?
thanks
very limited and can't find whats wrong with it.
----------------------------------------------
function selectMatching(x)
{
var S = document.getElementById("mymonth");
var L = S.options.length;
for (var i=0; i <= L-1; i++)
{
if ((String(x.value).substring(0,6)) ==
String(S.options.value).substring(0,6)) {S.selectedIndex=i};
}
}
-------------------------------------
and i use it in below 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 (25299)</option>
<option value="20080301" >March-2008 (2)</option>
<option value="20080201" >February-2008 (1)</option>
</select>
Day: <select name="myday" onChange="selectMatching(this);">
<option value="0" selected="selected">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" >25-Friday (25293)</option>
<option value="20080427" >27-Sunday (2)</option>
</select>
<input type="submit" value="View"/>
</p>
</form>
---------------------------------------------------
what i do is. if user selects from months menu script resets days menu to
all days (doesn't work on opera)
if user changes days menu function finds matching month from the first list
and selects it. Although days has 2 more numbers ad the end by substring i
cut that part.
can anyone offer another solution that would work on opera too without
changing current form and its values?
thanks