ffprog:ffprogjava2016:javascript

hello.html
<html>
<head>
  <title>JavaScript Testseite</title>
</head>
<body>
 
<h1>Mein Titel</h1>
 
<button onclick="alert('hallo')">
Click mich!</button>
 
</body>
</html>
rechner.html
<html>
<head>
  <title>JavaScript Testseite</title>
</head>
<body onload="neueRechnung()">
 
<script>
function neueRechnung() {
   var a = Math.floor(Math.random()*20);
   var b = Math.floor(Math.random()*20);
   richtig = a+b;
   var span = document.getElementById('rechnung');
   span.innerHTML = a+" + "+b+" = ?";
}
 
function hello() {
   var z = document.getElementById('zahl').value;
   if (z==richtig) {
 
   } else {
 
   }
   var span = document.getElementById('resultat');
   span.innerHTML = 'Resultat = '+r1;
   span.style.color="red";
}  
</script>
 
<h1>Mein Titel</h1>
 
<span id="rechnung"></span><br>
Ihr Resultat: <input id="zahl" />
<br>
<button onclick="hello()">
Click mich!</button>
 
<span id="resultat"></span>
 
</body>
</html>
  • ffprog/ffprogjava2016/javascript.txt
  • Last modified: 2016/08/19 17:05
  • by Ivo Blöchliger