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
| <head>
<script>
Function.prototype.bind = function(object) {
var __method = this;
return function() {
return __method.apply(object, arguments);
}
}
function souris(){
this.top = 0;
this.left = 0;
if(document.attachEvent) {
document.attachEvent('onmousemove', function(e){
this.left = event.x + document.body.scrollLeft;
this.top = event.y + document.body.scrollTop;
}.bind(this));
}
else if(document.addEventListener) {
document.addEventListener('mousemove', function(e){
this.left = e.pageX;
this.top = e.pageY;
}.bind(this), false);
}
}
function image(id) {
this.id=id;
this.chgSource = function(source){
document.getElementById(this.id).src=source;
}
this.affiche = function(){
document.getElementById(this.id).style.display="block";
}
this.cache = function(){
document.getElementById(this.id).style.display="none";
}
this.chgPos = function(top,left){
document.getElementById(this.id).style.top=top+"px";
document.getElementById(this.id).style.left=left+"px";
}
this.posSouris = function(){
this.chgPos(souri.top,souri.left);
}
}
function getImage(id) {
id = 'img' + id;
if(!imgs[id]) {
// Création de l'image DOM
img = document.createElement('img');
img.id = id;
img.style.position = 'absolute';
document.body.appendChild(img); // etc J'imagine que t'as déjà fais une fonction pour tout ca
imgs[id] = new image(id);
imgs[id].chgSource("../image/carte magic/" + id +".jpg");
}
return imgs[id];
}
var souri = new souris();
var imgs = new Array;
</script>
</head>
<body>
<table><tr><td>rezerzerezrezrzer</td>
<td id="td276"
onmouseout="getImage(this.id).cache();"
onmouseover="getImage(this.id); getImage(this.id).posSouris(); getImage(this.id).affiche();"
colspan="1">-----</td>
</tr></table>
</body> |