Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

object doesn't support this property or method

Status
Not open for further replies.

aigarzzz

Programmer
Apr 5, 2006
16
LV
<html>
<head>
<script type="text/javascript">
function login()
{
alert("Hello World!")
}
</script>
</head>
<body>
<form action="#" method="post" />
Login:<input type="text" name="name" id="login" />
<button type="button" value="Click me!" onclick="login()" />
</form>
</body>
</html>

why the line
Login:<input type="text" name="name" id="login" />
makes "object doesn't support this property or method" error, when i click button? how can i solve this problem?
 
The problem here is that the name of your input field is the same as your function name and causes problems. Try this:
Code:
<html>
	<head>
		<script type="text/javascript">
			function login()
			{
				alert("Hello World!");
			}
		</script>
	</head>
	<body>
		<form action="#" method="post" />
			Login:
			<input type="text" name="name" id="login_field" />
			<input type="button" value="Click me!" onclick="login();" />
		</form>
	</body>
</html>

Take Care,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top