veecrawn
03-19-2009, 08:31 PM
Hello and hi everyone!
The following script works perfectly under FF and even IE, but doesn't do anything under Chrome
It's a simple chronometer (I'm a beginner) to calculate gold gained, at the rate of 7 per second.
In the HEAD section
<script language="JavaScript">
<!--
var startTime = 0;
var start = 0;
var end = 0;
var diff = 0;
var timerID = 0;
function chrono(){
end = new Date();
diff = end - start;
diff = new Date(diff);
var msec = diff.getMilliseconds();
var sec = diff.getSeconds();
var min = diff.getMinutes();
var hr = diff.getHours()-19;
hr=0;
var gold = hr*60*60*7+min*420+sec*7;
document.getElementById("chronotime").innerHTML = gold;
timerID = setTimeout("chrono()", 10);
}
function chronoStart(){
start = new Date();
chrono();
}
function chronoContinue(){
document.chronoForm.startstop.value = "stop!";
document.chronoForm.startstop.onclick = chronoStop;
document.chronoForm.reset.onclick = chronoReset;
start = new Date()-diff;
start = new Date(start);
chrono();
}
function chronoReset(){
document.getElementById("chronotime").innerHTML = "0:00:00:000";
start = new Date();
}
function chronoStopReset(){
document.getElementById("chronotime").innerHTML = "0:00:00:000";
document.chronoForm.startstop.onclick = chronoStart;
}
function chronoStop(){
document.chronoForm.startstop.value = "start!";
document.chronoForm.startstop.onclick = chronoContinue;
document.chronoForm.reset.onclick = chronoStopReset;
clearTimeout(timerID);
}
//-->
</script>
In the body. I have the script called with a onLoad for a picture above this:
<div id ="chronojack" >
<span id="chronotime">0</span>
<form name="chronoForm">
<input type="hidden" name="startstop" value="start!" onClick="chronoStart()" />
<input type="hidden" name="reset" value="reset!" onClick="chronoReset()" />
</form>
</div>
The following script works perfectly under FF and even IE, but doesn't do anything under Chrome
It's a simple chronometer (I'm a beginner) to calculate gold gained, at the rate of 7 per second.
In the HEAD section
<script language="JavaScript">
<!--
var startTime = 0;
var start = 0;
var end = 0;
var diff = 0;
var timerID = 0;
function chrono(){
end = new Date();
diff = end - start;
diff = new Date(diff);
var msec = diff.getMilliseconds();
var sec = diff.getSeconds();
var min = diff.getMinutes();
var hr = diff.getHours()-19;
hr=0;
var gold = hr*60*60*7+min*420+sec*7;
document.getElementById("chronotime").innerHTML = gold;
timerID = setTimeout("chrono()", 10);
}
function chronoStart(){
start = new Date();
chrono();
}
function chronoContinue(){
document.chronoForm.startstop.value = "stop!";
document.chronoForm.startstop.onclick = chronoStop;
document.chronoForm.reset.onclick = chronoReset;
start = new Date()-diff;
start = new Date(start);
chrono();
}
function chronoReset(){
document.getElementById("chronotime").innerHTML = "0:00:00:000";
start = new Date();
}
function chronoStopReset(){
document.getElementById("chronotime").innerHTML = "0:00:00:000";
document.chronoForm.startstop.onclick = chronoStart;
}
function chronoStop(){
document.chronoForm.startstop.value = "start!";
document.chronoForm.startstop.onclick = chronoContinue;
document.chronoForm.reset.onclick = chronoStopReset;
clearTimeout(timerID);
}
//-->
</script>
In the body. I have the script called with a onLoad for a picture above this:
<div id ="chronojack" >
<span id="chronotime">0</span>
<form name="chronoForm">
<input type="hidden" name="startstop" value="start!" onClick="chronoStart()" />
<input type="hidden" name="reset" value="reset!" onClick="chronoReset()" />
</form>
</div>