Re: onChange IE?
- From: RobG <rgqld@xxxxxxxxxxxx>
- Date: Thu, 04 Oct 2007 05:29:14 -0700
On Oct 4, 4:06 pm, oscar.redo...@xxxxxxxxx wrote:
Hi!
I want to create a "select" by Javascript with this function:
function cargaOpciones(iRow)
{
var i
var sel = document.createElement('select');
i=0
sel.name='propRow' + iRow;
sel.id='propRow' + iRow;
sel.onChange="alert('Change');";
Javascript is case sensitive, even if HTML isn't - so use onchange.
And to satisfy a wider range of browsers, you need to assign a
function object or reference to the onchange property:
sel.onchange = function(){alert('Change');}
though using onchange with a select element has usability issues.
while (i<document.forms[0].cboOpciones.options.length)
That would be more efficient as:
var j = document.forms[0].cboOpciones.options.length;
while (i<j)
{
sel.options[i]=new Option(i,i)
i=i+1;
Why not:
i++;
--
Rob
.
- References:
- onChange IE?
- From: oscar . redondo
- onChange IE?
- Prev by Date: selecting a default option in a drop down list
- Next by Date: Re: selecting a default option in a drop down list
- Previous by thread: onChange IE?
- Next by thread: selecting a default option in a drop down list
- Index(es):
Relevant Pages
|
Loading