...

View Full Version : Dynamic style in Opera



huyhk
07-08-2002, 10:07 AM
Hello all,
I'm a beginner. I used below code to change style of a link. But it doesnot work in Opera.


<span id="id1" style="POSITION: relative; TOP: 17px">
<A STYLE="COLOR: green; TEXT-DECORATION: none" href ="http://mail.yahoo.com" onmouseover ="nrollIn('Test Link change','id1',this.href,'green','blue')" >Test Link change</A>
</span>

the script function is


function nrollIn(text,spName,href,oColor,nColor)
{
swapColor(text,spName,href,oColor,nColor,true);
}
function nrollOut(text,spName,href,oColor,nColor)
{
swapColor(text,spName,href,oColor,nColor,false);
}

function swapColor(text,spName,href,oColor,nColor, over)
{

var str = "<A HREF='" + href + "'";

if (over)
{
str+=" STYLE='TEXT-DECORATION:underline; color:"+nColor+"'";
str += " onmouseout =\"nrollOut('" + text+ "','"+spName+"',this.href,'"+nColor+"','"+oColor+"')\" >";
}
else
{
str+=" STYLE='TEXT-DECORATION:none; color:"+nColor+"'";
str += " onmouseover =\"nrollIn('" + text+ "','"+spName+"',this.href,'"+nColor+"','"+oColor+"')\"\" >";
}

str += text + "</A>";

display(spName, str);
}


// function 2
function display(id, str)
{

if (document.layers){
with (document[id].document)
{
open();
write(str);
close();
}
}
else if (document.all) {
document.all[id].innerHTML = str;
}
else {
document.getElementById(id).innerHTML = str;
}

}


Can anyone tell me the way to change the style of a link in Opera (4+). Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum