[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Event handler vs nested tables



I have a ducument which shows a different behaviour depending
on location of input text element with onChange handler.

At the end of the attached document there is a text field LANG11 and
select element LANGSEL. Both are nested in tables.

The idea is to propagate a selected value from LANGSEL to the text
field LANG11. 
The observations are:
1. In the current form, it doesn't work.
2. If you remove onChange handler from LANG11 field, it starts to
   work.
3. Or, let onChange there, but move the LANG11 field outside of
   the table (just in front of </form> tag). It again starts to work.

Is it a bug, or I have overlooked something?
Thanks Martin

---- BUG.HTML -----

<html> <head>

<SCRIPT LANGUAGE="JavaScript">
<!-- to hide script contents from old browser
function propagateSelection (form, obj, n) {
    var idx = obj.selectedIndex;
    var currval = obj.options[idx].value;
    if (currval != 'dummy') {
        var name = 'LANG' + n;
        form.LANG11.value = currval;
    }
}
//  -- end hiding -->
</SCRIPT>
<title></title>
</head>

<body >
<center>
<h1></h1>
</center>


<FORM METHOD=POST ACTION="http://localhost/cgi-bin/w2h/w2h.setgraph";>
<CENTER><H3>Graphics Devices Configuration</H3>
<TABLE BORDER=0 CELLSPACING=0 CELLPADING=0>
<TR><TH COLSPAN=2 ALIGN=LEFT><FONT COLOR="#FF0000">Apply</FONT></TH>
<TH>Description</TH><TH>Abbreviation</TH><TH>Language</TH></TR>
<TR><TD><INPUT TYPE="radio" NAME="SEL" VALUE="11">

</TD>
<TD>New:</TD>
<TD><INPUT TYPE="text" NAME="DESC11" SIZE=30 VALUE="" >
</TD>
<TD><INPUT TYPE="text" NAME="ABB11" SIZE=10 VALUE="" >
</TD>
<TD><TABLE BORDER=0 CELLSPACING=0 CELLPADPING=0><TR><TD ALIGN=CENTER><FONT SIZE=-1><SELECT NAME="LANGSEL" SIZE=5 onChange="propagateSelection(this.form, this, 11)">
<OPTION VALUE="dummy" SELECTED>Select language
<OPTION VALUE="HPGL">HPGL
<OPTION VALUE="PostScript">PostScript
<OPTION VALUE="Regis">Regis
<OPTION VALUE="Sixel">Sixel
<OPTION VALUE="Tektronix">Tektronix
<OPTION VALUE="XWindows">XWindows
</SELECT></FONT>
</TD></TR><TR><TD ALIGN=CENTER><INPUT TYPE="text" NAME="LANG11" SIZE=10 VALUE="" onChange="alert ('Hi')">
</TD></TR></TABLE></TD>

</TR>

</TABLE></CENTER>
</FORM>
</body> </html>

-- 
------------------------------------------------------
| Martin Senger     m.senger@dkfz-heidelberg.de      |
|                   voice: (0049) 6221/422340        |
|                   fax:   (0049) 6221/422333        |
------------------------------------------------------
--------------------------------------------------------------------
For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/