What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » mouse over to change image - link

mouse over to change image - link
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: mouse over to change image - link
I've written this special for you. :)

This is a simple JavaScript which uses Microsoft's blendTrans-filter to fade in and out on mouseover. Because it uses Microsoft filters, it'll only work in Internet Explorer. It works with a function fade() which accept one parameter containing the new URL for the image.

Here it comes!

Place this in the <HEAD> of your webpage:
code:
<script language=javascript>
//Browser check: the effects will only work on MSIE 5.5 or higher!
var detect = navigator.userAgent.toLowerCase(); //Get the browser information string
var ie = detect.indexOf("msie") + 1; //See if it's IE
var fullVersion = parseFloat(detect.substring(ie+4,detect.length)); //Retrieve the version number after 'MSIE '
if (ie && fullVersion >= 5.5) {
    var useFilters = true; //Ok, we're running on IE 5.5 or higher!
} else {
    var useFilters = false; //Nope, we can't use filters here...
}

var fadeduration = 0.5; //The duration of the fade in seconds.

//The fade function
function fade(img) {
    if(useFilters) { //Can we use the filters?
        document.images.fading_btn.style.filter="blendTrans(duration=" + fadeduration + ")"; //Fade duration
        //We have to check if the filter is still playing, otherwise this will give a wrong effect.
        if (document.images.fading_btn.filters.blendTrans.status != 1) {
            document.images.fading_btn.filters.blendTrans.Apply(); //Applying the filter
            document.images.fading_btn.src = img; //Setting the image
            document.images.fading_btn.filters.blendTrans.Play() //Playing the fade effect
        }
    } else {
        //Nope, we'll have to drop the fading effect and only change the src of the image.
            document.images.fading_btn.src = img;
    }
}
</script>
This is how you should use it on your button:
code:
<img src="btn0.jpg" width=150 height=30 name="fading_btn" onmouseover="javascript:fade('btn1.jpg')" onmouseout="javascript:fade('btn0.jpg')" border=0>
The only restriction is that it will only work in Internet Explorer 5.5 or higher. It's good to use this since 80% of the internet users are using IE 5.5+, but you can use a Flash animation as replacement if you want.

It's your choice! ;)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
05-15-2006 06:24 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
mouse over to change image - link - by DJKAL on 05-14-2006 at 11:18 PM
RE: mouse over to change image - link - by Supersonicdarky on 05-14-2006 at 11:21 PM
RE: mouse over to change image - link - by DJKAL on 05-14-2006 at 11:24 PM
RE: mouse over to change image - link - by Supersonicdarky on 05-14-2006 at 11:25 PM
RE: mouse over to change image - link - by DJKAL on 05-14-2006 at 11:55 PM
RE: mouse over to change image - link - by vaccination on 05-15-2006 at 03:58 PM
RE: mouse over to change image - link - by t1a0s on 05-15-2006 at 04:43 PM
RE: mouse over to change image - link - by vaccination on 05-15-2006 at 05:14 PM
RE: mouse over to change image - link - by matty on 05-15-2006 at 05:45 PM
RE: mouse over to change image - link - by Matti on 05-15-2006 at 06:24 PM
RE: mouse over to change image - link - by L. Coyote on 05-15-2006 at 07:04 PM
RE: RE: mouse over to change image - link - by Matti on 05-16-2006 at 05:22 PM
RE: mouse over to change image - link - by DJKAL on 05-16-2006 at 07:08 PM
RE: mouse over to change image - link - by Plik on 05-16-2006 at 07:36 PM
RE: mouse over to change image - link - by DJKAL on 05-16-2006 at 07:55 PM
RE: mouse over to change image - link - by Plik on 05-16-2006 at 08:15 PM
RE: mouse over to change image - link - by DJKAL on 05-16-2006 at 08:18 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On