<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js "></script>
<script type="text/javascript">
// JavaScript Document
function stopCount(timer,status){
clearTimeout(window.timer);
window.status=0;
$('#'+status).text(timer+'stopped');
}
function run_event(status){
$('#'+status).text("event ran");
}
function reportEditStatus(){
$('#timer1_status').text("timer clicked");
timer='timer1';
status='timer1_status';
stopCount(timer,status);
if (!status){
window.status=1;
window.timer=setTimeout(function(){run_event(status)},1000);
$('#'+status).text("timer started -- reportEditStatus");
}
}
function resetHighlite(){
$('#timer2_status').text("timer clicked");
timer='timer2';
status='timer2_status';
stopCount(timer,status);
if (!timer_is_on){
window.status=1;
window.timer=setTimeout(function(){run_event(status)},1000);
}
$('#'+status).text("timer started -- resetHighlite");
}
$(document).ready(function(){
$('#timer1').click(function(event) {
reportEditStatus();
});
$('#timer2').click(function(event) {
resetHighlite();
});
)};
</script>
</head>
<body >
The goal is not to tie to the ids.. that is just here out of convenience <br/><br/>
<a href="JavaScript:void(0);" id="timer1">timer1</a>
<p id="timer1_status">stoped</p>
<br/>
<a href="JavaScript:void(0);" id="timer2">timer2</a>
<p id="timer2_status">stoped</p>
</body>
</html>
|