ahallicks
01-08-2007, 02:49 PM
Hey guys I have the following JS file:
function fade_In(path, id)
{
var target = document.getElementById(id);
if (target.filters){
target.style.filter="blendTrans(duration=0.25)";
target.filters.blendTrans(duration=0.25).Apply();
target.filters.blendTrans.Play();
target.style.backgroundImage = "url("+path+")";}
}
function fade_Out(path, id)
{
var target = document.getElementById(id);
if (target.filters){
target.style.filter="blendTrans(duration=0.25)";
target.filters.blendTrans(duration=0.25).Apply();
target.filters.blendTrans.Play();
target.style.backgroundImage = "url("+path+")";}
}
Which is drawn in to an HTML document via the link in the head. The actualy javascript creates an awesome rollover effect when applied to links. The code for a certain link would look like:
<a id="freelisting" onMouseOver="fade_In('resources/images/free_listing_button_over.jpg', this.id)"
onMouseOut="fade_Out('resources/images/free_listing_button.jpg', this.id)" href="sign_up.php"></a>
Now this works really well in IE, but for some reason Firefox simply displays it as a normal rollover. Am I missing something or is there some way I can get it to work in FF as well. Maybe a different method for creating fading rollovers? Bear in mind that I'm not great at JS!
One more question... is there a way I can make it so that when you roll off the button it doesn't skip to the end of the 'onLoad' before fading back out again?
Any help would be greatly appreciated!
for an example head to http://pdt.ufindus.com/privateairmanagement and test in both browsers!
function fade_In(path, id)
{
var target = document.getElementById(id);
if (target.filters){
target.style.filter="blendTrans(duration=0.25)";
target.filters.blendTrans(duration=0.25).Apply();
target.filters.blendTrans.Play();
target.style.backgroundImage = "url("+path+")";}
}
function fade_Out(path, id)
{
var target = document.getElementById(id);
if (target.filters){
target.style.filter="blendTrans(duration=0.25)";
target.filters.blendTrans(duration=0.25).Apply();
target.filters.blendTrans.Play();
target.style.backgroundImage = "url("+path+")";}
}
Which is drawn in to an HTML document via the link in the head. The actualy javascript creates an awesome rollover effect when applied to links. The code for a certain link would look like:
<a id="freelisting" onMouseOver="fade_In('resources/images/free_listing_button_over.jpg', this.id)"
onMouseOut="fade_Out('resources/images/free_listing_button.jpg', this.id)" href="sign_up.php"></a>
Now this works really well in IE, but for some reason Firefox simply displays it as a normal rollover. Am I missing something or is there some way I can get it to work in FF as well. Maybe a different method for creating fading rollovers? Bear in mind that I'm not great at JS!
One more question... is there a way I can make it so that when you roll off the button it doesn't skip to the end of the 'onLoad' before fading back out again?
Any help would be greatly appreciated!
for an example head to http://pdt.ufindus.com/privateairmanagement and test in both browsers!