Örnek Uygulama Için Tiklayin
<title>Reflex Ölçer | www.aliakyildirim.com</title>
<!-- www.aliakyildirim.com | Reflex Ölçer -->
<body>
<tr>
<th valign="top">
<center>
</tr>
<b>"Başlat"</b> a basın ve renk değişir değişmez <b>"Dur"</b> a basın.
<script language="JavaScript">
<!--
//Reflext Tester
//Ali AKYILDIRIM - 1998 - 2012 - Bedavajava
//Submitted to Bedavajava for inclusion
//Visit http://www.aliakyildirim.com for this script
var startTime=new Date();
var endTime=new Date();
var startPressed=false;
var bgChangeStarted=false;
var maxWait=20;
var timerID;
var colors=new Array("tomato","chocolate","limegreen","crimson","darkslategray",
"aliceblue","mediumslateblue","cornflowerblue","darkorchid","darkkhaki","coral",
"darkolivegreen","cadetblue")
if (document.all||document.getElementById)
document.write(’<div id="reflex" style="width:135px;height:135px;border:1px solid black" onClick="stopTest()"></div>’)
//Bedavajava
function startTest()
{
if (document.all)
document.all.reflex.style.backgroundColor=colors[Math.floor(Math.random()*colors.length)];
else if (document.getElementById)
document.getElementById("reflex").style.backgroundColor=colors[Math.floor(Math.random()*colors.length)];
else if (document.layers)
document.reflexns.document.reflexns_sub.document.bgColor=colors[Math.floor(Math.random()*colors.length)];
bgChangeStarted=true;
startTime=new Date();
}
function remark(responseTime)
{
var responseString="";
if (responseTime < 0.10)
responseString="Süper, Kutlariz..!";
if (responseTime >= 0.10 && responseTime < 0.20)
responseString="Güzelll..!";
if (responseTime >=0.20 && responseTime < 0.30)
responseString="Daha Iyisi Olabilirdi..!";
if (responseTime >=0.30 && responseTime < 0.60)
responseString="Pratik Yapman Iyi Olur..!";
if (responseTime >=0.60 && responseTime < 1)
responseString="Sarhos musun..?";
if (responseTime >=1)
responseString="Uyuyor muydun..?";
return responseString;
}
function stopTest()
{
if(bgChangeStarted)
{
endTime=new Date();
var responseTime=(endTime.getTime()-startTime.getTime())/1000;
if (document.all)
document.all.reflex.style.backgroundColor="white";
else if (document.getElementById)
document.getElementById("reflex").style.backgroundColor="white";
else if (document.layers)
document.reflexns.document.reflexns_sub.document.bgColor="white";
alert("Tepki Süreniz: " + responseTime + " Saniye " + "\n" + remark(responseTime));
startPressed=false;
bgChangeStarted=false;
}
else
{
if (!startPressed)
{
alert("Teste Baslamak Için Baslat a Basin");
}
else
{
clearTimeout(timerID);
startPressed=false;
alert("Uyanik Seni! Erken Basma..!");
}
}
}
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("Çoktan Basladi. Durmak Için Dur a Bas");
return;
}
else
{
startPressed=true;
timerID=setTimeout(’startTest()’, 6000*randNumber());
}
}
// -->
</script>
<br>
<ilayer id="reflexns" width=135; height=135;><layer id="reflexns_sub" width=135; height=135; left=0 top=0 bgColor=yellow></layer></ilayer>
<form name="response">
<input type="button" value=" Baslat " onClick="startit()" style="font-weight:bold">
<input type="button" value=" Dur " onClick="stopTest()" style="font-weight:bold">
</form>
</body>
<!-- www.aliakyildirim.com | Reflex Ölçer -->
Örnek Uygulama Için Tiklayin