P
peter
(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.elements[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="JavaScript">
function displayFormValue(input) {
window.status=input.form[0].value;
// why this syntax can be used instead of "input.form.elements[0].value"
return true;
}
</script>
<!-- **************************************************************** -->
</HEAD><body>
<form name=form1>
<input name=text1 type=text onKeyUp="return displayFormValue(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.elements[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="JavaScript">
function displayFormValue(input) {
window.status=input.form[0].value;
// why this syntax can be used instead of "input.form.elements[0].value"
return true;
}
</script>
<!-- **************************************************************** -->
</HEAD><body>
<form name=form1>
<input name=text1 type=text onKeyUp="return displayFormValue(this);"
size=10/>
</form>
<br>good to see you
</body>
</html>