Schuffel_divs.php


Quell Code


<html>

<head>
	<title>Erstes Spiel!</title>

  </head>
<body>
   <button id="butt">Shuffel</button>
  <div id="wrapper"></div>

</body>
 

<script> 
  document.getElementById('butt').onclick=function(){
    document.getElementById('wrapper').innerHTML='';
 function arrayShuffle(){
  var tmp, rand;
  for(var i =0; i < this.length; i++){
    rand = Math.floor(Math.random() * this.length);
    tmp = this[i]; 
    this[i] = this[rand]; 
    this[rand] =tmp;
  }
}
  
Array.prototype.shuffle =arrayShuffle;
  var zahlen = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15);
  

zahlen.shuffle();

 var ausgabe = zahlen.join(" ");
 
  for(f=0;f<=15;f++){
    document.getElementById('wrapper').innerHTML+='<div id="a16" class="kart">'+zahlen[f]+'</div>';
  }
  }
</script>
 
</html>

Add Comment

* Required information
1000
Drag & drop images (max 1)
Powered by Commentics

Comments

No comments yet. Be the first!

Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0