Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    onmouseover slideshow script question

    at this address: http://www.castlekzar.com

    My question is this: what code in the tags will change the image back to the default on mouse out?
    here is one of my tags:
    Code:
    <a href="/store" onMouseover="changeimage(myimages[0],this.href)"><img border="0" src="images/jpg/catbutton.jpg" width="112" height="102"></a>
    I would really appreciate any help.

    I'm using this script:

    Code:
    <script>
    function changeimage(towhat,url){
    if (document.images){
    document.images.targetimage.src=towhat.src
    gotolink=url
    }
    }
    function warp(){
    window.location=gotolink
    }
    
    </script>
    <script language="JavaScript1.1">
    var myimages=new Array()
    var gotolink="#"
    
    function preloadimages(){
    for (i=0;i<preloadimages.arguments.length;i++){
    myimages[i]=new Image()
    myimages[i].src=preloadimages.arguments[i]
    }
    }
    
    
    preloadimages("images/banners/altbannercat.jpg","images/banners/altbannerphoto.jpg","images/banners/altbannergb.jpg","images/banners/altbannercontact.jpg","images/banners/altbannermeet.jpg", "images/banners/altbannerlink.jpg")
    </script>
    Thank you in advance!
    Last edited by blackthorn; 02-01-2007 at 01:21 AM. Reason: trying to make a better post

  • #2
    New Coder
    Join Date
    Feb 2006
    Posts
    21
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Try this link: JS info on this
    http://www.hesido.com/web.php?page=imageswapping

    A JS program link with easy html, accessing the JS
    http://www.dynamicdrive.com/dynamici...mroll2_dev.htm

    CSS example of mouse rollover:
    Code:
    //css
    a.nav{
    background:url(src.gif);
    }
    a.nav:hover{
    background:url(over.gif);
    }
    //mark up
    Hope this helps! I couldn't find the html simpler way to do this.

  • #3
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I appreciate it, but I'm not sure how this helps me... May just be over my head.

    The image with the mouseoever code is not the one being changed - it's the one in the middle of the six buttons - each button swaps the center image for a different jpg. I'm trying to figure out how to make the center image snap back to the original image if they move their mouse off the button without clicking it.

    Thank you for your help! (ummm.... explain things slowly for a non-coder, please?)
    Last edited by blackthorn; 02-01-2007 at 06:42 AM. Reason: typo

  • #4
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,524
    Thanks
    3
    Thanked 508 Times in 495 Posts
    the script you have chosen is no best

    but to use that script you will need to include the mouseout image in the preload list

    then

    <a href="/store" onMouseover="changeimage(myimages[0],this.href)" onMouseout="changeimage(myimages[10],this.href);" ><img border="0" src="images/jpg/catbutton.jpg" width="112" height="102"></a>

    if 10 was the mouse out image number

    There are many image swap scrips that are easier to understand if you do not wish to use the css solution
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #5
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You rock! Thank you very very much.


  •  

    Posting Permissions

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