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 5 of 5

Thread: onload

  1. #1
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    onload

    I have two functions that need to run when the page is open.
    I cannot combine them making one single function as from the one depends the further working of the page.
    I tried oninit eventhandler (one function i put in onload event while the another one i put in the oninit) but the function from oninit handler was not fired.

    Thanks in advance

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    <body onload="function1();function2();">

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes it worked but if i initialize the 1st function the 2nd will stop to respond.
    Like a bug. If i call the 2nd func only it works all fine. I can call the certain function from link's onclick eventhandler <a href="#" onclick="func()" ...

    Otherwise the func stop to responds. Do you have any idea why it happens?

    this is the function #2 that causes that all the links do not respond to click event http://www.dhtmlgoodies.com/scripts/...wn-menu2.html#

    Thanks a lot

  • #4
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Means all the links do not repospond to click event. I guess that initSlideDownMenu function is overriding the onclick. I explored addEvent method but am afraid if i touch anything in this code i can make it just worse.
    Maybe you know some better script that will animate the drop down menu avoiding the override the onclick?

    Thanks

  • #5
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It seems i was right. It is overriding the onclick so now i am using onmousedown to call the another function when an user clicks the link.
    Thanks for the reading ...


  •  

    Posting Permissions

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