Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving background in NS4

Status
Not open for further replies.

Poiter

Programmer
Oct 2, 2000
1
AU
I have some javascript code to make a background image move down the page and also perform auto re-direction after 30 seconds. It works only for IE4 (Although the re-direction works ok for NS4 + Opera).

Is there some way to make a moving background for NS4.
I have not used layers as yet and am not familar with them at present. As this is my entry point page I can't really have separate NS and IE pages.

This my code

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
function StartTimer(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
closeTime=hours*3600+mins*60+secs;
closeTime+=30;
Timer();
}

function Timer(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
curTime=hours*3600+mins*60+secs;
}

function timeLeft(){
Timer();
count = closeTime-curTime;
window.status = &quot;Automatic entry in &quot; + count + &quot; seconds&quot;;
}
// -->
</SCRIPT>

<META NAME=&quot;distribution&quot; CONTENT=&quot;global&quot;>
<META NAME=&quot;resource-type&quot; CONTENT=&quot;document&quot;>
</HEAD>

<BODY BACKGROUND=&quot;../images/binary2.jpg&quot; BGCOLOR=&quot;#000000&quot;>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!-- Begin

var backgroundOffset = 0;
var bgObject = eval('document.body');
function scrollBG(maxSize) {
backgroundOffset = backgroundOffset + 1;
if (backgroundOffset > maxSize) backgroundOffset = 0;
if(curTime>=closeTime)
location = &quot;pathframe.htm&quot;
else {
timeLeft();
bgObject.style.backgroundPosition = &quot;0 &quot; + backgroundOffset;
}
}
StartTimer();
window.setInterval(&quot;scrollBG(130)&quot;, 64);

// End -->
</SCRIPT> [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top