Re: simple code for selecting matching text in a listbox
- From: "Álvaro G. Vicario" <alvaroNOSPAMTHANKS@xxxxxxxxxxxxxx>
- Date: Tue, 29 Apr 2008 09:34:58 +0200
..nLL escribió:
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.
It doesn't work in Firefox either. So I'd say it only works in IE.
var S = document.getElementById("mymonth");
This line finds an HTML tag with id="mymonth". There isn't any on the page. Replace it with:
var S = document.forms["myform"].mymonth;
This way you call a form element with name "mymonth" in a form with name "myform":
<form method="post" name="myform" action="default.asp">
<p>
Select Month: <select name="mymonth"
Same here:
onChange="document.getElementById('myday').selectedIndex=0">
onChange="document.forms['myform'].myday.selectedIndex=0"
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
.
- References:
- Prev by Date: Re: What happened to my code
- Next by Date: Re: What happened to my code
- Previous by thread: Re: simple code for selecting matching text in a listbox
- Next by thread: Help with dropdownlist validation using javascript
- Index(es):