SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Threaded View

  1. #1
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ignorant wannabe baffled - easy for you though

    hello all, could really use a point in the right direction here PLEASE:

    am showing or hiding a field in form depending upon a value in another field. this code works great, EXCEPT for first time through script.

    <script type="text/javascript">
    function writebox(form) {
    if (form.repeat.value=='0') {
    document.getElementById("dDateE").style.visibility = "hidden";
    } else {
    document.getElementById("dDateE").style.visibility = "visible";
    }
    }

    so in addition I added this bit for onload, but it does not seem to be working, but how can it not be working? I mean it's identical right?

    window.onload = function writebox(form) {
    if (form.repeat.value=='0') {
    document.getElementById("dDateE").style.visibility = "hidden";
    } else {
    document.getElementById("dDateE").style.visibility = "visible";
    }
    }

    the first function is on top of page and that onload bit is down in a part of the script I know is executed first time through.

    I'm a newbie and lost and would really just a push in the right direction here!

    many thanks,

    mike
    Last edited by m300zx; Apr 20, 2011 at 10:55. Reason: incomplete


Bookmarks

Posting Permissions

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