Hi everyone
I hope someone can help me here , I'm very new to web page building but I have an opacity script that I managed to make work on text and it gives a nice fade into view effect when the mouse is moved over it.
I'm building my first ever webpage and wanted to have this effect on all the text sections without using the mouse to activate it.
Can anyone help me please?
I've included the full script so that you can see the what its doing.
<head>
<script>
var w3c=(document.getElementById)?true:false;
var ns4=(document.layers)?true:false;
var ie4=(document.all && !w3c)?true:false;
var ie5=(document.all && w3c)?true:false;
var ns6=(w3c && navigator.appName.indexOf("Netscape")>=0)?true:false;
var idlist=new Array();
function addFadeObject(el,starto,endo,step,timePerStep){
if(!ns4){
var idx=idlist.length;
idlist[idx]=(ie4)? document.all[el]:document.getElementById(el);
idlist[idx].idx=idx;
idlist[idx].starto=starto;
idlist[idx].endo=endo;
idlist[idx].step=step;
idlist[idx].timePerStep=timePerStep;
idlist[idx].T=0;
idlist[idx].Ostep=0;
idlist[idx].Ocount=0;
if(ie4| |ie5)idlist[idx].style.filter="alpha(opacity="+starto+")";
if(ns6)idlist[idx].style.MozOpacity=starto/100;
idlist[idx].onmouseover=function(){
clearInterval(this.T);
this.Ocount=this.starto;
this.Ostep=(this.starto<this.endo)?this.step:-this.step;
this.T=setInterval('adjop('+idx+')', this.timePerStep);
}
idlist[idx].onmouseout=function(){
clearInterval(this.T);
this.Ocount=this.endo;
this.Ostep=(this.starto<this.endo)?-this.step:this.step;
this.T=setInterval('adjop('+idx+')', this.timePerStep);
}
}}
function adjop(n){
var el=idlist[n];
if(ie4| |ie5)el.style.filter="alpha(opacity="+el.Ocount+")";
if(ns6)el.style.MozOpacity=el.Ocount/100;
el.Ocount+=el.Ostep;
if( ((el.starto<el.endo)&&((el.Ocount<el.starto)| |(el.Ocount>el.endo))) | | ((el.starto>el.endo)&&((el.Ocount>el.starto)| |(el.Ocount<el.endo))) )clearInterval(el.T);
}
</script>
</head>
<body bgcolor="#FFFFFF">
<p>
<div id="txt1" class="fadetext" style="width: 944; height: 43">
<p align="center"><b><font size="6" face="Arial">Example of text fading into view when page
loads</font></b>
</div>
<script>
new addFadeObject('txt1', 25, 100, 10 , 40);
</script>
</body>
Hope someone can help me as i cant really move on till this is done.
Thank you.