View Full Version : Rollover background-color button ( HELP PLEASE)

11-27-2008, 04:39 PM
1) Script Title: Rollover background-color button

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex5/button3.htm

3) Describe problem: Okay I have installed script ok, and all seems to be ok, but with I have 1 problem.

My site uses frames and in this script it seems you can only point to one 'TARGET' .
Is there any way I can point my links to two targets.

My script

<style type="text/css">



<script type="text/javascript">

* Rollover background-color button Script- Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code

//Specify optional button target: "_new" for new window, or name of FRAME target (ie "myframe")
var buttontarget="right_bot"

function change(e, color){
var el=window.event? event.srcElement: e.target
if (el.tagName=="INPUT"&&el.type=="button")

function jumpto2(url){
if (buttontarget=="")
else if (buttontarget=="_new")


<form onMouseover="change(event, 'yellow')" onMouseout="change(event, 'lime')">
<input type="button" value="Yahoo" class="initial2" onClick="jumpto2('http://yahoo.com')"> (Would like 1 of these links pointing to 'left_bot')
<input type="button" value="Google" class="initial2" onClick="jumpto2('http://google.com')">
<input type="button" value="AlltheWeb" class="initial2" onClick="jumpto2('http://alltheweb.com')">

Any help would be greatly appreciated.

11-27-2008, 06:10 PM
You can leave this part blank in the script:

var buttontarget="right_bot"

like so:

var buttontarget=""

because we will specify it in each onclick event, examples:

<input type="button" value="Yahoo" class="initial2" onclick="buttontarget='left_bot';jumpto2('http://yahoo.com/');">
<input type="button" value="Google" class="initial2" onclick="buttontarget='right_bot';jumpto2('http://google.com/');">

Be sure to specify it for each onclick event. If you don't, whichever button was clicked last, its buttontarget will still be in effect.

11-27-2008, 07:57 PM
Thankyou so much for your quick reply, I am very grateful.:)