"qu******@yahoo.com" <qu******@yahoo.comwrites:
var f = document.forms['myform'].elements['myele'];
how can I tell f is a text, select, or radio?
Each form control has a "type" property, whether it is an input,
select, button or textarea element.
For input and button elements, you specify the type in the type
attribute already. Textarea elements only gas the type "textarea",
and select elements have the types "select-one" and "select-multiple"
depending on the "multiple" attribute.
So, to check for text, select or radio:
if (f.type == "text") { // text
} else if (f.type == radio) { // radio
} else if (f.type.substring(0,7) == "select-") { // select
}
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'