Results 1 to 3 of 3

Thread: Rollover background-color button ( HELP PLEASE)

  1. #1
    Join Date
    Nov 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Rollover background-color button ( HELP PLEASE)

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

    .initial2{font-weight:bold;background-color:lime}

    </style>

    <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")
    el.style.backgroundColor=color
    }

    function jumpto2(url){
    if (buttontarget=="")
    window.location=url
    else if (buttontarget=="_new")
    window.open(url)
    else
    parent[buttontarget].location=url
    }

    //-->
    </script>

    ----------------------------------------------------------------------
    <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')">
    </form>




    Any help would be greatly appreciated.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,925
    Thanks
    43
    Thanked 3,190 Times in 3,154 Posts
    Blog Entries
    12

    Default

    You can leave this part blank in the script:

    Code:
    var buttontarget="right_bot"
    like so:

    Code:
    var buttontarget=""
    because we will specify it in each onclick event, examples:

    Code:
    <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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    instinctiv (11-27-2008)

  4. #3
    Join Date
    Nov 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thankyou so much for your quick reply, I am very grateful.

Bookmarks

Posting Permissions

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