(i'm new to javascript) I found the following Javascript and is confused by
its syntax. Why the expression "window.status= input.form[0].value;" is
valid (i verified this in ie6) and has the same result as the expression
"window.status= input.form.elem ents[0].value"?
As fas as I understand, "input.form " represents the form object. And, this
form object isnt an array. Why we can use array accessing syntax on an
ordinary object?
Any expert can help? thx
=============== =============== =============== =============== =============== =
=====
<html><HEAD>
<!-- *************** *************** *************** *************** **** -->
<SCRIPT LANGUAGE="JavaS cript">
function displayFormValu e(input) {
window.status=i nput.form[0].value;
// why this syntax can be used instead of "input.form.ele ments[0].value"
return true;
}
</script>
<!-- *************** *************** *************** *************** **** -->
</HEAD><body>
<form name=form1>
<input name=text1 type=text onKeyUp="return displayFormValu e(this);"
size=10/>
</form>
<br>good to see you
</body>
</html>
its syntax. Why the expression "window.status= input.form[0].value;" is
valid (i verified this in ie6) and has the same result as the expression
"window.status= input.form.elem ents[0].value"?
As fas as I understand, "input.form " represents the form object. And, this
form object isnt an array. Why we can use array accessing syntax on an
ordinary object?
Any expert can help? thx
=============== =============== =============== =============== =============== =
=====
<html><HEAD>
<!-- *************** *************** *************** *************** **** -->
<SCRIPT LANGUAGE="JavaS cript">
function displayFormValu e(input) {
window.status=i nput.form[0].value;
// why this syntax can be used instead of "input.form.ele ments[0].value"
return true;
}
</script>
<!-- *************** *************** *************** *************** **** -->
</HEAD><body>
<form name=form1>
<input name=text1 type=text onKeyUp="return displayFormValu e(this);"
size=10/>
</form>
<br>good to see you
</body>
</html>
Comment