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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

defaultStatus works with IE but not netscape

Status
Not open for further replies.

neetu

Programmer
May 25, 2001
11
IN
i hv a timer function code ...which displays the time taken by the user on visiting this page....
the time-taken status is displayed in the status bar of IE but not Netscape.
is there anyother way where i can display in the status bar...
kindly help

var here = new Date();
function timer()
{
var now = new Date();
var m = Math.floor((Math.ceil((now.getTime() - here.getTime())/1000)/60));

if (m<1) m = 0 + &quot; minutes&quot;;
else if (m==1) m = m + &quot; minute&quot;;
else m = m + &quot; minutes&quot;;

var s = Math.ceil((now.getTime() - here.getTime())/1000);
if (s == 0) s = s + &quot; seconds.&quot;;
if (s == 1) s = s + &quot; second.&quot;;
if (s > 1 && s < 60) s = s + &quot; seconds.&quot;;
if (s == 60) s = 0 + &quot; seconds.&quot;;
if (s > 60) s = s - (60*parseInt(m)) + &quot; seconds.&quot;;

var r = &quot;You've been here &quot; + m + &quot; and &quot; + s ;

defaultStatus = r;

setTimeout('timer()', 1000);
}

</script>
</head>
<body onload=&quot;timer();&quot; onunload=&quot;self.Status='';&quot;>

</body>
</html>
 
defaultStatus=&quot;something&quot; itself works perfect in nn4.61 at least
check your script again
 
thnx for the reply Vitus!
but then why isint it working fine in netscape....coz i tried to output the result via a input box , instead of using defaultStatus...it works just fine.as ive re-written it below, but i want the time to be displayed in the status bar....How can i get this???

<html>
<head>
<script language=JavaScript>


var here = new Date();
function timer()
{
var now = new Date();
var m = Math.floor((Math.ceil((now.getTime() - here.getTime())/1000)/60));

if (m<1) m = 0 + &quot; minutes&quot;;
else if (m==1) m = m + &quot; minute&quot;;
else m = m + &quot; minutes&quot;;

var s = Math.ceil((now.getTime() - here.getTime())/1000);
if (s == 0) s = s + &quot; seconds.&quot;;
if (s == 1) s = s + &quot; second.&quot;;
if (s > 1 && s < 60) s = s + &quot; seconds.&quot;;
if (s == 60) s = 0 + &quot; seconds.&quot;;
if (s > 60) s = s - (60*parseInt(m)) + &quot; seconds.&quot;;

var r = &quot;You've been here &quot; + m + &quot; and &quot; + s ;

document.f.timea.value=r;
//defaultStatus = r;

setTimeout('timer()', 1000);
}

</script>
</head>
<body onload=&quot;timer();&quot;>

<form name=f>
<input name=timea size=80>
</form>
</body>
</html>
 
hie!
ur code works fine in nn4.61,
i just removed changed

//document.f.timea.value=r;
defaultStatus = r;

ur code from ur first poste is also pretty workable...
i have no other version of nn; what version do u use?

regards, vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top