1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Multiplications</title>
<style>
* {
font-weight:bold;
}
ul {
display:none;
list-style-type:none;
padding:5px;
position:absolute;
width:auto;
border:double 10px black;
background-color:lime;
z-index:2;
cursor:move;
}
li {
clear:both;
cursor:move;
z-index:2;
}
#off {
color:white;
cursor:default;
border:2px black solid;
background-color:red;
width:25px;
text-align:center;
font-size:20px;
float:right;
}
</style>
</head>
<body>
<ul id="table" style="top:100px;left:100px">
<li id="off" title="fermez-moi"> X </li>
</ul>
<div id="cadre">
<label for="un">saisissez un entier</label>
<input type="text" size="4" id="nbr" />
<input type="button" id="go" value="afficher la table" />
</div>
<script type="text/javascript">
function b(q){return document.getElementById(q)}
//////////////////////
// affichage tables //
//////////////////////
b("go").onclick=function(){nouveau(b('nbr'))}
function nouveau(p){
if(p.value==Math.abs(parseInt(p.value))){
while(b("table").getElementsByTagName("li").length>1){
b("table").removeChild(b("table").lastChild)
}
b("table").style.display="block";
for(i=0;i<11;i++){
li=document.createElement("li");
b("table").appendChild(li);
li.appendChild(document.createTextNode(i+" X "+ p.value + " = " + i*p.value));
}
}
else{
b("table").style.display="none";
}
}
b("off").onclick=function(){b("table").style.display="none"}
/////////////////////////////////////////////////////////////////////
////////////////////
// fenêtre maison //
////////////////////
var capt;
b("table").onmousedown=function(e){
capt=this;
ev=e||event;
evx=ev.clientX;
evy=ev.clientY;
posx=evx-parseInt(this.style.left)+document.documentElement.scrollLeft;
posy=evy-parseInt(this.style.top)+document.documentElement.scrollTop;
}
b("table").onmouseup=function(){capt=false}
document.onmousemove=function(e){
if(capt){
ev=e||event;
evx=ev.clientX;
evy=ev.clientY;
capt.style.left=evx-posx+document.documentElement.scrollLeft+"px";
capt.style.top=evy-posy+document.documentElement.scrollTop+"px";
}
}
///////////////////////////////////////////////////////////
/////////////////////
// anti sélectionn //
/////////////////////
function no(e){
el= e ? e.target : event.srcElement;
if(el.type!="text"){return false}
}
document.onmousedown=no;
document.onmouseup=no;
if(typeof document.onselectstart!="undefined"){document.onselectstart=no}
</script>
</body>
</html> |
Partager