Funtion Problem

S

Steve Bishop

I'm getting an error "Object doesn't support this property or method."
Help appreciated.

<html>
<head>
<script type="text/javascript">
function showtable(){
var myform1 = document.form1;
if(myform1.T1.value=="Size Mix")
{
document.getElementByID("Table1").style.visibility="hidden"
}
}

</script>

</head>

<body onLoad= "showtable()">
<form name=form1><input type="text" name="T1" value="Size Mix">
<table border="1" id="Table1" width="100%">
 
M

Michael Winter

[snip]
<script type="text/javascript">
function showtable(){
var myform1 = document.form1;
if(myform1.T1.value=="Size Mix")
{
document.getElementByID("Table1").style.visibility="hidden"
}
}

</script>

[snip]

Why are you asking this question again? If my solution, or Mr Cornford's,
was not sufficient, you should have followed up with more information or a
clarification. You state above, like you did last time, saying that you
get a error, but you don't indicate on which line above that error is
supposed to have occurred.

I told you this last time, and I'll tell you again: JavaScript is
case-sensitive. The method name is "getElementById", NOT "getElementByID"
(notice the uppercase "D").

If this doesn't solve the problem, give us more information not a third,
identical post.

Mike
 
K

kaeli

I'm getting an error "Object doesn't support this property or method."
{
document.getElementByID("Table1").style.visibility="hidden"

document.getElementById("Table1").style.visibility="hidden"
^^
case-sensitive

Oh, and the script as a whole isn't cross-browser nor does it degrade
cleanly (so that old browsers don't crash, they just don't do anything).
I sure hope this is not for a production-quality website.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top