View Full Version : onClick question
12-18-2002, 02:14 PM
I'm currently creating a site as a major assignment in school, so this is pretty important to me.
The site is <a href="http://freewebs.com/emyrlin">here</a> for you to view and keep up with what I'm talking about.
I was told that I should use a different colored button in the left frame when someone visits the links under each topic button. (i.e. if someone clicks How To and explores the links connected to that button, the HowTo button should have another color.)
The problem is that I already use onMouseover for those buttons, and onClick to open the link in two separate frames (area and bottom). Now, is it possible to put in yet another onClick function that changes the button to a different one?
Help muchly appreciated!
12-18-2002, 02:37 PM
You can perform muliple function with the onClick by separating them with a semicolon. Here is an example:
<title>Change Button Color</title>
<INPUT TYPE="button" VALUE="Click" onClick="chgbgcolor(this);doalert()" STYLE="background:yellow">
12-18-2002, 02:39 PM
Just add another function to your existing onclick, e.g.:
onclick="function1(smith); function2(jones); function3(alias);"
Of course, you'll need to devise a function to make the color change.
12-18-2002, 05:17 PM
It's not a radio button, it's actually an image, a jpg of a button to click. :)
It didn't work with the adding of an extra function; but here's the code so you'll know how it looks:
return true;"><img vspace="0" src="images/howto1a.jpg"
12-18-2002, 09:21 PM
I don't believe you will be able to change the image with the onClick because you are also changing it with the onMouseOut. The onClick would change the image to a different one, but then once you mouse out the image would be changed again.
12-18-2002, 09:48 PM
keep all the events in functions in the <head> and just pass the files needed for each event. also keep a global boolean variable that, if false (or true) will nullify the onMouseOut for that link.
this may seem confusing, but take it a step at a time and NEVER overcomplicate it!
12-19-2002, 02:41 AM
If you're using frames, this shouldn't be a problem... just change the "navigation" frame to have your "clicked" navigation link (picture) show a different image. I'm assuming that your "main frame" changes when this link is clicked. i.e.:
<img onclick="this.src='whatever.jpg'" />
This gets a slight bit more complicated if you're using include files, etc. instead of frames, but this should be pretty easy in this instance...
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.