<form name="ausgabe">
<div align="center"><center><p><input type="button" value="Start" name="B3"
onclick="tempo3()" style="font-family: Arial; font-size: 15pt">
<script language="JavaScript"><!--
x = 0;
x2 = 0;
x3 = 0;
function tempo3()
{
x3 = 0;
window.setTimeout("tempo()",1000);
}
function tempo()
{
document.ausgabe.versuche.value = x3;
x = 0;
x2 = 0;
y = Math.random();
if(y <= 0.5)
{
x = "1";
}
if(y >= 0.5)
{
x = "2";
}
if(x == "1")
{
document.ausgabe.text.value = "Gas";
}
if(x == "2")
{
document.ausgabe.text.value = "Bremsen";
}
window.setTimeout("tempo2()",700);
}
function tempo2()
{
if(x2 == x)
{
document.ausgabe.text.value = "";
x3 = x3+1;
window.setTimeout("tempo()",200);
}
else
if(x2 != x)
{
document.ausgabe.text.value = "Unfall !";
}
}
function gas()
{
x2 = "1";
}
function bremsen()
{
x2 = "2";
}
// --></script><input type="text" name="text" size="10"
style="background-color: rgb(255,255,0); font-family: Arial; font-size: 15pt; text-align: center; border: thin solid rgb(0,0,0)">
<input type="text" name="versuche" size="4"
style="font-family: Arial; font-size: 15pt; background-color: rgb(255,255,0); text-align: center; border: thin solid rgb(0,0,0)">
</p>
</center></div><div align="center"><center><p><input type="button" value="Gas" name="B1"
onclick="gas()" style="font-family: Arial; font-size: 15pt"> <input
type="button" value="Bremse" name="B2" onclick="bremsen()"
style="font-family: Arial; font-size: 15pt"></p>
</center></div>
</form>
Reaktions Test<div align="center"><center><p><input type="button" value="Start" name="B3"
onclick="tempo3()" style="font-family: Arial; font-size: 15pt">
<script language="JavaScript"><!--
x = 0;
x2 = 0;
x3 = 0;
function tempo3()
{
x3 = 0;
window.setTimeout("tempo()",1000);
}
function tempo()
{
document.ausgabe.versuche.value = x3;
x = 0;
x2 = 0;
y = Math.random();
if(y <= 0.5)
{
x = "1";
}
if(y >= 0.5)
{
x = "2";
}
if(x == "1")
{
document.ausgabe.text.value = "Gas";
}
if(x == "2")
{
document.ausgabe.text.value = "Bremsen";
}
window.setTimeout("tempo2()",700);
}
function tempo2()
{
if(x2 == x)
{
document.ausgabe.text.value = "";
x3 = x3+1;
window.setTimeout("tempo()",200);
}
else
if(x2 != x)
{
document.ausgabe.text.value = "Unfall !";
}
}
function gas()
{
x2 = "1";
}
function bremsen()
{
x2 = "2";
}
// --></script><input type="text" name="text" size="10"
style="background-color: rgb(255,255,0); font-family: Arial; font-size: 15pt; text-align: center; border: thin solid rgb(0,0,0)">
<input type="text" name="versuche" size="4"
style="font-family: Arial; font-size: 15pt; background-color: rgb(255,255,0); text-align: center; border: thin solid rgb(0,0,0)">
</p>
</center></div><div align="center"><center><p><input type="button" value="Gas" name="B1"
onclick="gas()" style="font-family: Arial; font-size: 15pt"> <input
type="button" value="Bremse" name="B2" onclick="bremsen()"
style="font-family: Arial; font-size: 15pt"></p>
</center></div>
</form>
Dieses Javascript ist im Grunde ein sehr einfacher Fahrsimmulator bei es für jede richtige Reaktion Punkte gibt.
Es gibt zwei Button die man abwechselnd entsprechend der anweisung im Textfeld anklicken muss.
Klickt man falsch ist das Spiel zuende.
