Object error in function

S

Steve Bishop

I keep getting "Object does not support property or method". Help
appreciated. Thanks.
<html>
<head>
<SCRIPT LANGUAGE="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

I keep getting "Object does not support property or method". Help
appreciated. Thanks.
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">

The 'type' attribute is required (and sufficient); 'language' is not. This
should read

function showtable(){
var myform1 = document.form1

End statements with a semi-colon (;).
if(myform1.T1.value=="Size Mix")
{
document.getElementByid "Table1").style.visibility="hidden"

If this is a direct copy, your problem is two-fold:

1) The method name is "getElementById". Remember that case is significant
in JavaScript.
2) You missed the opening parenthesis in the method call.

The missing semi-colon appies here, too.

[snip]

Mike
 
R

Richard Cornford

Steve Bishop said:
I keep getting "Object does not support property or method".
document.getElementByid "Table1").style.visibility="hidden"
^
I
Case sensitivity, it should be an upper case I in getElementById.

Richard.
 

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

Forum statistics

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

Latest Threads

Top