Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple events on one onClick command

Status
Not open for further replies.

erigby

Programmer
Feb 14, 2005
6
US
I want to put two onClick events on one button, I'm not even sure at this point if it's possible. I want to combine a "showLayer('page3')" with a "scroll(0, 0)"

Any ideas on what that might look like?

Richelle
 
Code:
<input type='button' onClick="showLayer('page3');scroll(0,0)" value="Show and Scroll">

hope that helps

"It is the mark of an educated mind to be able to entertain a thought without accepting it." - Aristotle
 
It's much cleaner and easier to maintain if you call a function from your onClick event, and have that function run the several commands.
Code:
function doClick() {
   showLayer('page3');
   scroll(0,0);
}
...
<input type='button' onClick="doClick();" value="Show and Scroll">

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top