







|
|
|
 |
| > conflit entre javascript |
[ Posté par cassian ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 07-09-2003 à 19:29 | 3 messages ]
  Bonjour à tous,
je suis totalement néophyte en terme de javascript, et je me trouve confronter à un pb assez délicat compte tenu de mes compétences: j'essaie de construire un site pour une association et pour dynamiser mes pages j'ai voulu y insérer qq script.
Le pb, c'est que j'observe une imcompatibilité entre 2 scripts (qui enpêche l'execution de ces derniers)
Les 2 scripts en questions proviennent de ejs: il s'agit de
- étoile de texte rotative
- horloge digitale
J'ai trouvé un post où on parlait de doublons dans les variables mais bon en cherchant dans mon code je n'ai pas identifié ces "doublons"
Par conséquent je viens vous demander un peu d'aide !!!!!
Je vous remercie d'avance pour votre aide
Pour mémoire voici les 2 script en question:
horloge:
Entre les balises head:
<script>
c1=new Image();c1.src="c1.gif"
c2=new Image();c2.src="c2.gif"
c3=new Image();c3.src="c3.gif"
c4=new Image();c4.src="c4.gif"
c5=new Image();c5.src="c5.gif"
c6=new Image();c6.src="c6.gif"
c7=new Image();c7.src="c7.gif"
c8=new Image();c8.src="c8.gif"
c9=new Image();c9.src="c9.gif"
c0=new Image();c0.src="c0.gif"
function affiche(h,m,s){
if (h<=9){
document.images.a.src=c0.src
document.images.b.src=eval("c"+h+".src")}
else {
document.images.a.src=eval("c"+Math.floor(h/10)+".src")
document.images.b.src=eval("c"+(h%10)+".src")}
if (m<=9){
document.images.d.src=c0.src
document.images.e.src=eval("c"+m+".src")}
else {
document.images.d.src=eval("c"+Math.floor(m/10)+".src")
document.images.e.src=eval("c"+(m%10)+".src")}
if (s<=9){
document.images.g.src=c0.src
document.images.h.src=eval("c"+s+".src")}
else {
document.images.g.src=eval("c"+Math.floor(s/10)+".src")
document.images.h.src=eval("c"+(s%10)+".src")}}
function tictac(){
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
affiche(hours,minutes,seconds)
setTimeout("tictac()",1000)}
</script>
+
<BODY onLoad="var SymTmpWinOpen = window.open; window.open = SymWinOpen; tictac(); window.open = SymTmpWinOpen;"
etoile de texte rotative:
<SCRIPT LANGUAGE="JavaScript">
/*
Etoile de texte rotative
SCRIPT EDITE SUR L'EDITEUR JAVASCRIPT
http://www.editeurjavascript.com
*/
/*
CREDITS:
Text Wheel
By Urs Dudli and Peter Gehrig
Copyright (c) 2003 Peter Gehrig and Urs Dudli. All rights reserved.
Permission given to use the script provided that this notice remains as is.
Additional scripts can be found at http:www.24fun.com
info@24fun.com
2/5/2003
IMPORTANT:
If you add this script to a script-library or script-archive
you have to add a highly visible link to
http:www.24fun.com on the webpage
where this script will be featured
CONFIGURATION:
Go to http:www.24fun.com
and create your own text animation
with our new Text Factory.
*/
var text=new Array()
text[0]=' >>>> jjjjj'
text[1]=' >>>> uui'
text[2]=' >>>> uuuu'
text[3]=' >>>> iiiiiiiiiiiii'
text[4]=' >>>> iiiooooooooooo'
text[5]=' >>>> ppppppppppppp'
var textfont="Verdana"
var textfontsize="32";
var textfontcolor="#0000FF"
var textweight="900"
var textitalic="0"
var message=new Array()
var x_textposition=0
var y_textposition=0
var i_segments=Math.round(360/text.length)
var i_grad=0
var grad=0
var colorrgbred
var colorrgbgreen
var colorrgbblue
var windowwidth
var windowheight
var ns4=document.layers?1:0
var ns6=document.getElementById&&!document.all?1:0
var ie=document.all?1:0
if (textweight=="bold") {textweight=900}
if (textweight=="normal") {textweight=100}
if (textitalic=="italic") {textitalic=1}
if (textitalic=="normal") {textitalic=0}
for (i=0;i<=text.length-1;i++) {
message[i]=text[i].replace(/'/g,"`")
}
translateintorgb()
function translateintorgb() {
var hexanewred=textfontcolor.substring(1,3)
var hexanewgreen=textfontcolor.substring(3,5)
var hexanewblue=textfontcolor.substring(5,7)
colorrgbred=parseInt("0x"+hexanewred)
colorrgbgreen=parseInt("0x"+hexanewgreen)
colorrgbblue=parseInt("0x"+hexanewblue)
}
function initiate() {
windowheight=parseInt(document.body.clientHeight)/2
windowwidth=parseInt(document.body.clientWidth)-40
for (i=0;i<text.length;i++) {
var thisspan=eval("document.all.rotationstyle"+i)
thisspan.style.posLeft=20
thisspan.style.posTop=0
}
settexts()
}
function settexts() {
for (i=0;i<text.length;i++) {
var thisid="rotationobj"+i
var thisspan=eval("rotationstyle"+i)
thisspan.innerHTML='<OBJECT ID="'+thisid+'" CLASSID="CLSID:369303C2-D7AC-11d0-89D5-00A0C90833E6" STYLE="position:relative;width:'+windowwidth+'px;height:'+2*windowheight+'px">'+
'<PARAM NAME="Line0001" VALUE="SetLineStyle(0)">'+
'<PARAM NAME="Line0002" VALUE="SetLineColor(0,0,0)">'+
'<PARAM NAME="Line0003" VALUE="SetFillColor('+colorrgbred+','+colorrgbgreen+','+colorrgbblue+')">'+
'<PARAM NAME="Line0004" VALUE="SetFont(''+textfont+'', '+textfontsize+', '+textweight+', '+textitalic+', 0, 0)">'+
'<PARAM NAME="Line0005" VALUE="Text(''+message[i]+'',0, 2, 0)">'+
'</OBJECT>'
}
for (i=0;i<text.length;i++) {
var thisobj=eval("rotationobj"+i)
thisobj.Rotate(0,i_grad,0)
i_grad+=i_segments
}
startscroll()
}
function startscroll() {
for (i=0;i<text.length;i++) {
var thisobj=eval("rotationobj"+i)
thisobj.Rotate(1,2,0)
}
timer=setTimeout("startscroll()",20)
}
if (ie) {
for (i=0;i<text.length;i++) {
var thisid="rotationstyle"+i
var thisobjid="rotationobj"+i
document.write("<SPAN ID='"+thisid+"' STYLE='position:absolute'>")
document.write("<OBJECT ID='"+thisobjid+"' CLASSID='CLSID:369303C2-D7AC-11d0-89D5-00A0C90833E6'>")
document.write("</OBJECT>")
document.write("</SPAN>")
onload=initiate
}
}
</SCRIPT>
Voilà, j'espère ne pas abuser !!
a bientôt.
[ Ce Message a été édité par: cassian le 2003-09-07 19:30 ]
 
|
[ Posté par dkrte ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 08-09-2003 à 14:00 | 899 messages ]
  Pour le script horloge, tu as besoin de cette ligne <body onLoad="tictac()">
Dans le deuxième script, tu as cette ligne
onload=initiate
Ces deux lignes ne sont pas compatible, pour arranger ca, tu remplaces la balise BODY par celle la <body onLoad="tictac();initiate();"> et tu supprimes la ligne onload=initiate
| [ Posté par cassian ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 08-09-2003 à 14:52 | 3 messages ]
  arg, cruelle erreur !! j'ai oublié de vérifier les commandes d'auto-démarrage !!!
Merci beaucoup (c sincère!!, si si !!)
Je teste ça dès ce soir.
cassian.
[ Ce Message a été édité par: cassian le 2003-09-08 14:53 ]
| [ Posté par dkrte ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 08-09-2003 à 14:55 | 899 messages ]
  allez ca marcher
Bon courage
| [ Posté par cassian ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 08-09-2003 à 23:07 | 3 messages ]
  bon, ben effectivement ça a résolu le pb pour les javascript mais maintenant ça me fige mes gifs !?! alors là j'avoue rester un peu interloqué; apparemment le pb viendrait du script étoile de texte rotative (qui commence à me péter les b$$$$$)
Alors si l'un d'entre vous identifie le pb et sa solution, je suis preneur....
Voilà, merci
cassian (qui, snif, est tout triste pr ses gifs..)
| [ Posté par Stone ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 10-09-2003 à 13:23 | 1187 messages ]
  Ca,j'ai jamais compris pourquoi mais quelques fois, quand tu as un gif ou tu peux cliquer dessus, ton gif se fige...
Franchement, je ne pas ce que je pourrai te conseiller pour regler ce pb...
|
|
Services email :
  Vous devez vous identifier pour profiter des services par email du forum.
|

|