Desbrina Jadeite

Joined: 11 Jun 2005 Posts: 2958 Location: Earth
|
Posted: Wed Jan 23, 2008 7:07 am Post subject: need some javascript editing help |
|
|
I have this javascript code from the internet
| Code: | <script type="text/javascript">
<!--
var startTime=new Date();
var endTime=new Date();
var startPressed=false;
var bgChangeStarted=false;
var maxWait=20;
var timerID;
function startTest()
{
document.bgColor="#000000";
bgChangeStarted=true;
startTime=new Date();
}
function remark(responseTime)
{var responseString="";
if (responseTime < 0.01) responseString="You are super human. I bow to Thee!"
if (responseTime > 0 && responseTime <0.01) responseString="You are THE speed demon!"
if (responseTime >.01 && responseTime <.05 ) responseString="Stunning! But you can still get faster...";
if (responseTime >= 0.05 && responseTime <.10) responseString="Pretty excellent!";
if (responseTime >= 0.10 && responseTime < 0.20) responseString="Not bad at all!";
if (responseTime >=0.20 && responseTime < 0.30) responseString="Pretty average, c'mon try harder!";
if (responseTime >=0.30 && responseTime < 0.60) responseString="Ok, this isn't funny! You can do better!!!";
if (responseTime >=0.60 && responseTime < 1) responseString="You're not over 90 are you? Try using your finger and not your walking stick";
if (responseTime >=1) responseString="Hello?! Wakey wakey! Time for breakfast!";
return responseString;
}
function stopTest()
{
if(bgChangeStarted)
{
endTime=new Date();
var responseTime=(endTime.getTime()-startTime.getTime())/1000;
document.bgColor="#990000";
alert("You reaction time is " + responseTime + " seconds " + "\n" + remark(responseTime));
startPressed=false;
bgChangeStarted=false;
}
else
{
if (!startPressed)
{
alert("Press 'Start' to commence testing!");
}
else
{
clearTimeout(timerID);
startPressed=false;
alert("OI!! No cheating! Press 'start' again...");
}
}
}
var randMULTIPLIER=0x015a4e35;
var randINCREMENT=1;
var today=new Date();
var randSeed=today.getSeconds();
function randNumber()
{
randSeed = (randMULTIPLIER * randSeed + randINCREMENT) % (1 << 31);
return((randSeed >> 15) & 0x7fff) / 32767;
}
function startit()
{
if(startPressed)
{alert("Already started. Press stop to stop");
return;
}
else
{
startPressed=true;
timerID=setTimeout('startTest()', 6000*randNumber());
}
}
// -->
</script> |
For some reason when using background colour in a css file, this code can't change the background colour
This is how i have the code set in the file
| Code: | | background-color:#990000; |
This is the address to the whole file
http://darknesswithin.com.ru/darknesswithin.css
I would also like to edit it so that instead of telling you your time, if your time was less than .30 then it sets $_SESSION['action'] == "reward"
Pay is up to you _________________ Midnight Tempest - A Sailor Moon TCG
Balanced Force - A Star Wars TCG |
|