...

View Full Version : "On Click" <--Two Instructions at the same time?



interlog
07-12-2007, 07:44 PM
<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

VIPStephan
07-12-2007, 08:05 PM
Iím not the baddest JS pro but I think you can without problems fire more than one functions in the event handler.


onclick="function1(); function2(); return false;">link</a>


And by the way: http://blog.reindel.com/2006/08/11/a-hrefjavascriptvoid0-avoid-the-void/

interlog
07-12-2007, 08:52 PM
onclick="function1(openDiv('t2')">); function2(simple_menu); return false;">link</a>

^^ i did that but no luck

_Aerospace_Eng_
07-12-2007, 08:55 PM
That was just an example.

onclick="openDiv('t2'); simple_menu(); return false;">link</a>

interlog
07-12-2007, 08:58 PM
http://ftp1.dns-systems.net/~msjonline/splash.php?groupID=664&view=list

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

_Aerospace_Eng_
07-12-2007, 09:10 PM
It would help if you actually had good html. Your coding is awful.
You have this

<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

<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?

interlog
07-12-2007, 09:44 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum