bonjour
je suis en train de faire un script qui fait une rotation de texte et j'essai de le faire en poo le script fonctionne bien mais mon probleme c'est qu'il est executer seulement au demarage et je ne sais pas du tout comment faire pour ajouter un evenement pour chaque elements(onclick) en poo
je me demandait aussi si ma demarche etait la bonne ou si il falait revoir la facon de concevoir le programme
du code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <script type="text/javascript" language="JavaScript"> function roro(elem){ this.el=document.getElementById(elem); this.rond(); this.gg=00; } roro.prototype.rond = function(){ this.gg+=30; if(navigator.vendor){ this.el.style.WebkitTransform='rotate('+this.gg+'deg)'; } else{ this.el.style.MozTransform='rotate('+this.gg+'deg)'; } if(this.gg==720){ this.gg=00; return false; } var lui=this; setTimeout( function() { lui.rond(); }, 300 ); } function init(){ d1=new roro('txa'); d2=new roro('txb'); d3=new roro('txc'); d4=new roro('txd'); } onload=init; </script> </head> <body> <br><br><br><br> <span id='txa'>azetergrt</span> <span id='txb' onclick='?????'>jjytjuj</span> <span id='txc'>gdfgtytfy</span> <span id='txd'>opuikytru</span>
Partager