Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2008
    Posts
    10
    Thanks
    3
    Thanked 1 Time in 1 Post

    performing a javascript function multiple times

    Hey, i've got this javascript code:
    Code:
    window.onload=function() { document.onclick=function() { hide('mydiv'); }; };
    Does anybody know how i could modify this code so that i could perform this function on another div at the same time.
    Right now if i use this code on another div then it ignores the code for the first div.
    I've tries modifying it myself but had no luck.
    Thanks.

  • #2
    Banned
    Join Date
    Mar 2009
    Posts
    248
    Thanks
    3
    Thanked 68 Times in 66 Posts
    Code:
    window.onload=function() { document.onclick=function() { hide('mydiv'); hide('anotherdiv');}; };
    ...separated by a semi-colon.

  • Users who have thanked 12 Pack Mack for this post:

    FeralUK (07-06-2009)

  • #3
    New Coder
    Join Date
    Apr 2008
    Posts
    10
    Thanks
    3
    Thanked 1 Time in 1 Post
    Thank You. Works perfectly... and such a simple solution.


  •  

    Posting Permissions

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