Hi,
Here's what I've got:
<html>
<head>
<script type="text/javascript">
function foo() {
document.write( "foo");
alert("foo");
}
function displayFormElem ents(var form) {
alert("actually inside the function now");
document.write( "displayFormEle ments called");
var length = form.length;
for(var i = 0; i < length; i++) {
document.write( "element " + i + " is " + form.type);
}
}
function CheckForNull() {
var formId=document .getElementById ("myForm");
if(formId.eleme nts[0].value == "") {
alert("form may not be null");
}
formId.submit() ;
}
</script>
</head>
<body>
Form test
<form id="myForm" action="index.h tml" method="post">
<input type=text name="text1"></input>
<input type=button onClick="CheckF orNull()" value="submit" />
<P>
<script language="javas cript" type="text/javascript">
foo();
document.write( "body script section");
var form = document.getEle mentById("myFor m");
document.write( "form contains " + form.length + " elements");
displayFormElem ents(form);
document.write( "after the call to displayFormElem ents");
</script>
</form>
</body>
</html>
This is my test bed, so to speak. I want to understand what it is I'm
looking at (in the forms) so I wanted to see the data. So, in a
different page I tried to do it and nothing happens in the script tag
in the body section. What am I doing wrong?
Andy
Here's what I've got:
<html>
<head>
<script type="text/javascript">
function foo() {
document.write( "foo");
alert("foo");
}
function displayFormElem ents(var form) {
alert("actually inside the function now");
document.write( "displayFormEle ments called");
var length = form.length;
for(var i = 0; i < length; i++) {
document.write( "element " + i + " is " + form.type);
}
}
function CheckForNull() {
var formId=document .getElementById ("myForm");
if(formId.eleme nts[0].value == "") {
alert("form may not be null");
}
formId.submit() ;
}
</script>
</head>
<body>
Form test
<form id="myForm" action="index.h tml" method="post">
<input type=text name="text1"></input>
<input type=button onClick="CheckF orNull()" value="submit" />
<P>
<script language="javas cript" type="text/javascript">
foo();
document.write( "body script section");
var form = document.getEle mentById("myFor m");
document.write( "form contains " + form.length + " elements");
displayFormElem ents(form);
document.write( "after the call to displayFormElem ents");
</script>
</form>
</body>
</html>
This is my test bed, so to speak. I want to understand what it is I'm
looking at (in the forms) so I wanted to see the data. So, in a
different page I tried to do it and nothing happens in the script tag
in the body section. What am I doing wrong?
Andy
Comment