Greetings,
i'm going nuts can someone explain me why this doesn't work:
<html>
<head>
<script type="text/javascript">
function foo(f)
{
for (var i = f.firstChild; i ; i = i.nextSibling)
{
if (i) alert("exists");
document.writeln(i.name);
}
</script>
</head>
<body>
<form>
<input type=checkbox name="a">
<input type=checkbox name="b">
<input type=checkbox name="c">
<input type=checkbox name="d">
<input type=button value=http://www.webdeveloper.com/forum/archive/index.php/"Press me" onclick="foo(this.form)">
</form>
</body>
</html>
Instead of getting an alert message and a printed meesage for all form elements i'm only getting for the first and it seems like all elements are undefined except the first. What's happening?
Thanks in advance
i'm going nuts can someone explain me why this doesn't work:
<html>
<head>
<script type="text/javascript">
function foo(f)
{
for (var i = f.firstChild; i ; i = i.nextSibling)
{
if (i) alert("exists");
document.writeln(i.name);
}
</script>
</head>
<body>
<form>
<input type=checkbox name="a">
<input type=checkbox name="b">
<input type=checkbox name="c">
<input type=checkbox name="d">
<input type=button value=http://www.webdeveloper.com/forum/archive/index.php/"Press me" onclick="foo(this.form)">
</form>
</body>
</html>
Instead of getting an alert message and a printed meesage for all form elements i'm only getting for the first and it seems like all elements are undefined except the first. What's happening?
Thanks in advance