dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: (short) Simple function error, I can't see where I went wrong - newbie

Hybrid View

  1. #1
    Join Date
    Feb 2014
    Posts
    1

    (short) Simple function error, I can't see where I went wrong - newbie

    I know I'm a newbie 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

  2. #2
    Join Date
    Oct 2012
    Location
    Croatia
    Posts
    255
    In addition to typo "onlcick" you have to place id of an element inside of quotation marks.

    HTML Code:
    <input type="button" value="Transect One" onclick="CoverPage('TransectOne')">

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles