mardi 12 mars 2019

<!doctype html>
<head lang="fr">
<meta charset="utf-8">
<style>
html,body{
height:100%;
margin:0;
}
#svg1{
width:100%;
height:100%;
}
body{
user-select: none;
overflow:hidden;
}
#txt1{
text-align:left;
font-family:sans-serif;
font-size:500px;
position:absolute;
width:100%;
top:0;
left:0;
}
#txt2{
text-align:right;
font-family:sans-serif;
font-size:500px;
position:absolute;
width:100%;
top:0;
left:0;
}
</style>
<body>
<svg id="svg1">

</svg>
<div id="txt1"></div>
<div id="txt2"></div>
<script>
var ww=window.innerWidth;
var wh=window.innerHeight;
var c1=document.getElementById("c1");
var txt1=document.getElementById("txt1");
var txt2=document.getElementById("txt2");
var dice1,dice2;

function launchDice(){
dice1=Math.round(Math.random()*19)+1;
dice2=Math.round(Math.random()*19)+1;
txt1.innerHTML=dice1;
txt2.innerHTML=dice2;
}

document.body.addEventListener("click", launchDice)
</script>
</body>
</head>