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 7 of 7
  1. #1
    New Coder
    Join Date
    Jul 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    "On Click" <--Two Instructions at the same time?

    <div href="javascript:void(0)" class="menu_button" onClick="openDiv('t2');">Food & Drink</div>
    <div id="t2" style="display:none;">

    ^ here is the code i have got for a drop down menu.

    When somebody clicks on it, i want the css style to change...I cant seem to do this as onClick is already being used :S

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,695
    Thanks
    6
    Thanked 1,011 Times in 984 Posts
    I’m not the baddest JS pro but I think you can without problems fire more than one functions in the event handler.
    Code:
    onclick="function1(); function2(); return false;">link</a>
    And by the way: http://blog.reindel.com/2006/08/11/a...void-the-void/

  • #3
    New Coder
    Join Date
    Jul 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    onclick="function1(openDiv('t2')">); function2(simple_menu); return false;">link</a>

    ^^ i did that but no luck

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    That was just an example.
    Code:
    onclick="openDiv('t2'); simple_menu(); return false;">link</a>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Jul 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    http://ftp1.dns-systems.net/~msjonli...=664&view=list

    ^^ thts the link..It stil dont seem to work :S

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    It would help if you actually had good html. Your coding is awful.
    You have this
    Code:
           <div class="menu_button" onclick="openDiv('t2'); simple_menu(); return false;">link</a> href="javascript:void(0)">Finance &amp; Legal Services</div>
    change it to this
    Code:
           <div class="menu_button" onclick="openDiv('t2');">Finance &amp; Legal Services</div>
    Now that we got that straightened out. What exactly are you trying to do? You have no simple_menu() function. What styles do you want to apply to the divs? I see you already have class="simple_menu" on the divs. Can you not just use that?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    New Coder
    Join Date
    Jul 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When a user clicks on the button, i want its sub-buttons to open up, whilst the first buttons changes its style..When clickd upon.


  •  

    Posting Permissions

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