Anyone here good at javascript?

Discussion in 'JavaScript' started by mopacfan, Sep 6, 2005.

  1. #1
    I have this code from ImageReady that changes out a bunch of images. The arguments are passed in from the OnMouseover and OnMouseout events in the anchor tag.

    function changeImages() {
    	if (document.images && (preloadFlag == true)) {
    		for (var i=0; i<changeImages.arguments.length; i+=2) {
    			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
    		}
    	}
    }
    
    Code (javascript):
    I'd like to know how I can put the arguments in this function so they can be removed from the anchor tag. Otherwise the html gets very bloated since it's the same images over and over that get swapped out for the animation.
     
    mopacfan, Sep 6, 2005 IP
  2. richieg100

    richieg100 Peon

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well I dont understand how this can involve more than 2 images.
    You have the onMouseover image and the OnMouseout image. How can there be more?
    The only way i can see that is:
    1. The onMouseover command triggers a slideshow of images
    or
    2. each time the viewer moves the mouse over the image it changes to another random image.

    please post back which scenario is the correct one because if you don't there really isn't much I can do for you.

    In the meantime:
    you should probably check out this
    http://www.dynamicdrive.com/dynamicindex15/dissolveroll.htm

    when u get back to me, ill write u a custom script
    -Richie
     
    richieg100, Sep 6, 2005 IP
  3. mikmik

    mikmik Guest

    Messages:
    356
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You could just do it with CSS and two background images, one for 'a:hover'

    So you make
    
    <style type="text/css">
    .link_class a:link,  a:visited{
    	background-image: url(assetts/img_off.jpg);
    	background-repeat: no-repeat;
    	background-position: left top;
    }
    
    .link_class a:hover, a:active {background-image: url(assetts/img_on.jpg);
    	background-repeat: no-repeat;
    	background-position: left top;
    }
    </style>
    
    Code (css):
    then, just add class="link_class" to your links. Prolly use decscendent selectors, and just have to put the code once, and that's that!

    Sorry, I am over tired, but I qwill clarify later if you want :O)))

    Or someone may correct any mistakes I make, or help with their own ideas! LOL
     
    mikmik, Sep 10, 2005 IP