I
Ivan S
Hi all.
There is an Javascript error (xxxx is not a function) if there exists
a function name same as input's name (or id) property.
Here is source code sample:
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function test() {
alert("Test");
}
</script>
</head>
<body>
<form>
<input type="button" name="test" onclick="test();" value="Test" />
</form>
</body>
</html>
When input button is clicked, and error message is shown saying "test
function is not defined".
If I change function name, or name property of the input element,
everything works fine.
So, I guess there is a name collision between function name and
input's element name. I don't know why is this happening, can someone
explain it to me?
Tnx
There is an Javascript error (xxxx is not a function) if there exists
a function name same as input's name (or id) property.
Here is source code sample:
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function test() {
alert("Test");
}
</script>
</head>
<body>
<form>
<input type="button" name="test" onclick="test();" value="Test" />
</form>
</body>
</html>
When input button is clicked, and error message is shown saying "test
function is not defined".
If I change function name, or name property of the input element,
everything works fine.
So, I guess there is a name collision between function name and
input's element name. I don't know why is this happening, can someone
explain it to me?
Tnx