Forum Moderators: open
function update(series)
{
var icon =eval(series +"icon");
document.getElementById( icon ).style.MozOpacity=1;
document.getElementById( icon ).filters.alpha.opacity=100;
}
I am trying to define the opaque property of Image1 at runtime based on mouseover events of Image2.
Thanks Jim
Also, you should probably add a check to make sure the element was found before you try to modify it's properties.
function update(series)
{
var icon = document.getElementById( series + "icon" );
if(!icon ) return;
icon.style.MozOpacity=1;
icon.filters.alpha.opacity=100;
}
I set up the following to test:
function update(series)
{
var icon = document.getElementById(series + "icon");
icon.filters.alpha.opacity=100;
}
I then checked it in Firefox's Javascript Console, and it choked on the "icon.filters.alpha.opacity=100;" line with an error code - icon has no properties
Any ideas?
function update(series)
{
var icon = document.getElementById(series + "icon");
icon.filters.alpha.opacity=100;
}I then checked it in Firefox's Javascript Console, and it choked on the "icon.filters.alpha.opacity=100;" line with an error code - icon has no properties
1. That's why you should have the check:
if(!icon ) return;
In your case, though, you might use this to debug by doing this:
if(!icon )
{
alert('unable to find icon with id: ' + series + 'icon');
return;
}
2. I could be wrong, but I think filters are an IE only thing. So when you try and modify the filter property of an object, Firefox (and any other non-IE browser for that matter) will probably barf because the property doesn't exist. Maybe you could do something like this to get around it:
if( icon.filters )
{
if( icon.filters.alpha )
{
icon.filters.alpha.opacity=100;
}
}