n2deep
Joined: 12 Mar 2008 Posts: 1
|
Posted: Wed Mar 12, 2008 10:11 pm Post subject: Hide timer functionality on login page |
|
|
Hi,
I want to be able to hide the following timer on the log-in page but have it display on all subsequent pages upon successful login. ALL pages are created from a Master page which makes what I want to accomplish somewhat difficult for me but I believe it can be done.
===============================
<script type="text/javascript" language="javascript">
var seconds=0
var minutes = 45
try{document.getElementById("timer").innerHTML='45'}catch(err) {}
function display(){ //display time (minutes/seconds) before session timeout occurs
if (seconds<=0){ //if seconds reaches 0, a minute has passed so deduct a minute from the minute column
seconds=60
minutes-=1
}
if (minutes<=-1){ //stop the system at 0.0
seconds=0
minutes+=1
}
else //subtract a second as long as the above conditions aren't met
seconds-=1
try{document.getElementById("timer").innerHTML=minutes + " minutes " + seconds + " seconds"}catch(err) {}
setTimeout("display()",1000)
}
</script>
===============================
The code works fine. Once again, the code resides on a Master page that is accessed by all pages (including the log-in page). Is there a way i can call the code only when the user has successfully logged in?
I am attempting to use this on a .Net website and Javascript is not my strength. Any/all help is greatly appreciated! |
|