Javascript/Math.floor()

解説 数値の端数を切り捨てる
sample1
---
sample1code
var sample1Btn = document.getElementById("sample1Btn");
sample1Btn.onclick = function(){
  var sample1;
  sample1 = Math.floor(Math.random()*10);
  document.getElementById("sample1Div").innerHTML = sample1;
}
sample2
sample2code
var s2Array = ["../../img/@rise3.png", "../../img/@rise4.png", "../../img/css3.jpg"];
document.s2Name.src = s2Array[Math.floor(Math.random()*s2Array.length)];
	
sample3
sample3code
function s3Func(min, max) {
  return Math.floor(Math.random() * (max - min) + min);
}
var s3Between = s3Func(10, 20);
var s3Div = document.getElementById("s3Div");
s3Div.innerHTML = 'p>10以上20未満の整数の乱数:' + s3Between + '/p>';