Login | Register | FAQ
Anonymous

Problem (short) script

+ Post a reply

2 posts Page 1 of 1


Problem (short) script

by climberBrian » Sun Feb 09, 2014 4:01 am

I know I'm a noob and most of you will spot the error, but I can't figure it out for the life of me:

Currently, I have two ways to do the same thing, a test so that I can replicate things repeatedly. One relies on a function (that I can easily have multiple hidden ids, classes, etc), the other is inline:

//Green works, red doesn't, they should produce the same result for my test.

<script type="text/javascript">
function CoverPage(transect)
{
document.getElementById(transect).style.visibility="hidden";
}
</script>
</head>
<body>

<input type="button" value="Hide Table" onclick=document.getElementById("TransectOne").style.visibility="hidden";>

<input type="button" value="Transect One" onlcick=CoverPage(TransectOne);>

Thanks in advance,
Brian
User avatar

climberBrian

  • Posts: 1
  • Joined: Sun Feb 09, 2014 3:51 am

Re: Problem (short) script

by XainPro » Tue Feb 11, 2014 2:15 pm

now both will work ;0


<!DOCTYPE html>
<html>
<head>
<title> Register Form </title>
</head>

<body>

<script type="text/javascript">
function coverPage(trans)
{

document.getElementById(trans).style.visibility="hidden";
}
</script>


<input type="button" value="Hide Table" onclick=document.getElementById("TransectOne").style.visibility="hidden";>

<input type="button" value="Transect One" onclick="coverPage('TransectOne')" ;>

<table width="200" border="1" cellspacing="0" cellpadding="1" id="TransectOne">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>


</body>


</html>
User avatar

XainPro

  • Posts: 3933
  • Joined: Fri Feb 17, 2012 8:10 pm


+ Post a reply

Page 1 of 1

cron