L'éditeur JavaScript
Visiteur non-identifié | Identifiez-vous | Devenir membre
Code perdu ? | Combien de visiteurs sur votre site ?
Rechercher :
Page d'accueil
     Home Page

JavaScript
     Tous les scripts
     Proposer un script
     Recherche de script
     AJAX
     Cours de JavaScript
     Liste de discussion
     Forums

Services :
     CountUs
     myCircle
     ClickInText
     XooIt

Trucs et astuces :
     HTML / CSS
     PHP / MySQL
     Réferencement
     Graph / Présentation
     Toutes les astuces
     Ajouter un article

MailingList :
122609 abonnés

Annuaire webmaster :      Hebergement web
     Referencement
     Sites webmasters
     XHTML - CSS2
     PHP
     Affiliation - Pub
     FAI

     Annuaire webmaster

Ressources pour webmasters :
     Kit graphique
     Foire aux questions
     Les membres
     Devenir annonceur
     Faire un lien
     Contact

Partenaire :
     Compteur live
     Créer un forum
     Le PHP facile
     Comscripts
     Liens sponsorisés
     Blog
     Page Rank
     Gifs animés, f...
     Poésie et cita...
     Azote.org - no...
     Easy-script.com
     Web creation ...
     Je crée mon site
     Outils de créa...
     Electroniq...
     K i s s design
     Créer son site...
     Les autres
     Votre site ici ?


Le forum ] [ Préférences ] [ Nouveau sujet ] [ Répondre ] [ Recherche ] [ Vos sujets ] [ Tous lus ] [ Flux RSS ]


[ Forums >> JavaScript >> Problèmes avec un script de l'éditeur JavaScript ? >> Prob: afficher texte défilant dans boite ]

> Prob: afficher texte défilant dans boite
[ Posté par ALFaransI ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 29-02-2004 à 17:32 | 4 messages ]

Salut, j'ai un problème avec le script "Afficher un texte défilant (dans une boite)" http://www.editeurjavascript.com/scripts/scripts_textes_01.php

Bon déjà, j'ai plusieurs script sur cette page, je vous donne le code :

Code:
<html>


<head>
<!-- DEBUT DU SCRIPT -->
<SCRIPT LANGUAGE="JavaScript">
/*
SCRIPT EDITE SUR L'EDITEUR JAVASCRIPT
http://www.editeurjavascript.com
*/
size=30;
x = 3*size;
place = 0;
texte = 'Apprenez';
texteDef = texte;
function defil()
{
texteDef = texteDef.substring(1,texteDef.length);
while(texteDef.length < x)
{
texteDef += " - " + texte;
}
document.defil.defilbox.value = texteDef;
tempo2 = setTimeout("defil()", 50)
}
</SCRIPT>
<!-- FIN DU SCRIPT -->

<SCRIPT LANGUAGE="JavaScript">
<!--
var doh = "Le bouton droit de votre souris a été désactivé.";
function noclick(scx) {
if (navigator.appName == "Netscape" && scx.which == 3) {
alert(doh);
return false; }
if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) {
alert(doh);
return false; } }
document.onmousedown = noclick
// -->
</SCRIPT>
<!-- DEBUT DU SCRIPT -->
<SCRIPT LANGUAGE="JavaScript">
/*
SCRIPT EDITE SUR L'EDITEUR JAVASCRIPT
http://www.editeurjavascript.com
Ne copiez ce code qu'une fois dans votre page
*/

function ChangeMessage(message,champ)
{
if(document.getElementById)
document.getElementById(champ).innerHTML = message;
}
</SCRIPT>
<!-- FIN DU SCRIPT -->
<!-- DEBUT DU SCRIPT -->
<!-- SCRIPT TROUVE SUR WEBJS -->
<SCRIPT LANGUAGE="JavaScript">
<!-- CE SCRIPT EST EDITE PAR EDITEUR JAVASCRIPT -->
function ScanCookie(variable)
{
cook = document.cookie;
variable += "=";
place = cook.indexOf(variable,0);
if (place <= -1)
return("0");
else
{
end = cook.indexOf(";",place)
if (end <= -1)
return(unescape(cook.substring(place+variable.length,cook.length)));
else
return(unescape(cook.substring(place+variable.length,end)));
}
}

function CreationCookie(nom,valeur,permanent)
{
if(permanent)
{
dateExp = new Date(2020,11,11);
dateExp = dateExp.toGMTString();
ifpermanent = '; expires=' + dateExp + ';';
}
else
ifpermanent = '';
document.cookie = nom + '=' + escape(valeur) + ifpermanent;
}

if(ScanCookie("dejapopup")==0)
{
window.open('popup1.html','_blank','toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,copyhistory=0,menuBar=0,width=300,height=300,left=600,top=250');
CreationCookie("dejapopup","oui",false)
}

</SCRIPT>
<!-- FIN DU SCRIPT -->

<meta name="generator" content="Namo WebEditor v5.0(Trial)">
</head>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red" leftmargin="0" marginwidth="0" onLoad="defil();" onUnload="clearTimeout(tempo2);">
<p align="center"><img src="imgaccueilcours32.gif" align="right" width="680" height="560" border="0" alt="Apprenez et appliquez la science de la religion" usemap="#ImageMap1"></p>
<table align="center" cellpadding="0" cellspacing="0" width="250" height="560" BORDER="1">
<tr align="center" valign="middle" bordercolor="black">
<td align="center" valign="middle" bordercolor="black" height="538">

<DIV ID=ejs_texte></DIV>
</td>
</tr>
<tr>
<td align="center" valign="middle" bordercolor="black">
<!--L'éditeur JavaScript : http://www.editeurjavascript.com/-->
<FORM NAME="defil">
<SCRIPT LANGUAGE="JavaScript">
document.write('<INPUT TYPE="text" NAME="defilbox" SIZE=' + size + '>');
</SCRIPT>
</FORM>
<!-- FIN DU SCRIPT --> </td>
</tr>
</table>

<map name="ImageMap1">
<area shape="rect" coords="60, 106, 236, 142" href="http://www.islam-traditionnel.net/cours/croyance/accueilcroyance.htm" onMouseOver="ChangeMessage('Petites explications sur la croyance musulmane','ejs_texte')" onMouseOut="ChangeMessage('','ejs_texte')">
<area shape="rect" coords="59, 153, 229, 189" href="http://www.islam-traditionnel.net/cours/pratiques/accueilpratique.htm" onMouseOver="ChangeMessage('Partie traitant essentiellement sur la pri&egrave;re pour le moment','ejs_texte')" onMouseOut="ChangeMessage('','ejs_texte')">
<area shape="rect" coords="61, 246, 217, 281" href="http://www.islam-traditionnel.net/cours/califes/accueilcalife.htm" onMouseOver="ChangeMessage('Les premiers Califes','ejs_texte')" onMouseOut="ChangeMessage('','ejs_texte')">
<area shape="rect" coords="60, 297, 177, 325" href="http://www.islam-traditionnel.net/cours/imam/accueilimam.htm" onMouseOver="ChangeMessage('Les fondateurs d&rsquo;&eacute;cole de jurisprudence connus','ejs_texte')" onMouseOut="ChangeMessage('','ejs_texte')">
</map>
<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]=' >>>>>>>>> L ISLAM'
text[1]=' >>>> TRADITIONNEL'
text[2]=' >>>>>>>>> L ISLAM'
text[3]=' >>>> TRADITIONNEL'
text[4]=' >>>>>>>>> L ISLAM'
text[5]=' >>>> TRADITIONNEL'

var textfont="arial"
var textfontsize="24";
var textfontcolor="#006666"
var textweight="1000"

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=1000}
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=310
thisspan.style.posTop=-100
}
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>
</body>

</html>



Le message d'erreur est :

Ligne 102
Car 1
Erreur 'tempo2' est indéfini
Code 0



[ Posté par ALFaransI ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 29-02-2004 à 17:39 | 4 messages ]

par curiosité , j'ai enlevé la ligne onload=initiate dans autre script (celui de texte rotatif à la fin) et maintenant le texte défilant marche, mais bien sûr pas le texte rotatif.

Est ce qu'il y a un autre code pour utiliser les deux en même temps ? et apparemment c'est le onload 2X dans la page qui va pas !

merci de votre aide !

[ Posté par v1nce ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 01-03-2004 à 11:32 | 4024 messages ]

pour déclencher 2 (n) scripts sur un événement il ne faut pas doubler les onload mais utiliser la formulation suivante

... onload="script1();script2();..;scriptn();"

ou alors
<script>
function ensemble()
{
script1();
script2();
/* etc */
scriptn();
}
</script>

..onload="ensemble();"..

________________
V1nce
Si je les ai oubliés les bonjour, merci et au revoir sont implicites

Brevets logiciels : dites NON !
http://petition.eurolinux.org/index.html
http://swpat.ffii.org/index.fr.html

[ Posté par ALFaransI ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 01-03-2004 à 14:54 | 4 messages ]

donc, précisement avec le code que j'ai fourni, j'écris comment please ?

........quelques temps plus tard : ça y est g trouvé, g rajouté la fonction initiate du script sur le texte rotatif (puisque c'était cette fonction qui était onload) dans le body onload du texte défilant dans une boite.
Code:

<body onLoad="defil(); initiate();" onUnload="clearTimeout(tempo2);">



[ Ce Message a été édité par: ALFaransI le 2004-03-01 17:41 ]

[ Posté par #:-{)% ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 02-03-2004 à 01:08 | 2548 messages ]

Alut

bravo, tu as trouvé la solution
mais je préconise de mettre initiate(); à la fin du script de l'étoile rotatif
dans le if(ie) juste avant le dernier }
cela evitera 1 erreur avec Moz qui n'accepte pas l'étoile

pour l'erreur tempo2, mets var tempo2; au début du script hors fonction

Atchao bonne nuit


________________
Oubli du BBcode, rééditer!
barbe-sauvage ex Mozopiens devenu renard de feu... et un peu konq sur les bords

Les OG et les DR, je M pas :/

[ Posté par ALFaransI ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 02-03-2004 à 13:07 | 4 messages ]


pour l'erreur tempo2, mets var tempo2; au début du script hors fonction


et j'écris comment alors ?

[ Posté par #:-{)% ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 03-03-2004 à 02:24 | 2548 messages ]

bin simplement
<SCRIPT type="text/javascript">
var tempo2;
...les autres var...
...les autres fonctions...
</SCRIPT>
même pas besoin de = qqlchose

________________
Oubli du BBcode, rééditer!
barbe-sauvage ex Mozopiens devenu renard de feu... et un peu konq sur les bords

Les OG et les DR, je M pas :/




Services email :

Vous devez vous identifier pour profiter des services par email du forum.
Le forum ] [ Préférences ] [ Nouveau sujet ] [ Répondre ] [ Recherche ] [ Vos sujets ] [ Tous lus ] [ Flux RSS ]






compteur gratuit
actuellement en ligne

    PUBLICITE



     ANNUAIRE WEBMAST.
Lycos hebergement
Domaine gratuit 1 an, 1000 Mo d'espace, 100 comptes Email, 20 Go de trafic /mois, 1 base mySQL, 1 comptes FTP pour moins de 7 € / mois. Par mal d'offres à découvrir.
http://webcenter.lycos.fr/
Cat : Hebergement web
Voir l'annuaire webmaster


     LES SCRIPTS :
78 à éditer
68 à copier/coller
247 des membres
2580 sur le web
>> Tous les scripts

     LES MEMBRES :
65977 membres
4650 comptes CountUs
1842 comptes myCircle

     LES FORUMS :
14 forums
40361 topics
191690 messages
>> Les forums

    SONDAGE

Vous avez un blog ou site classique ?
Un blog
Un site classique
Les deux !
La mini-astuce "Referencement" du jour par krucial
Pour savoir combien de pages de votre site sont indexées dans Google, il vous suffit de taper, dans la boite de recherche du moteur : "site:http://www.votresite.com";.
Proposer votre mini-astuce | Archives des mini-astuces
© 1999-2012 EJS - Tous droits réservés | CNIL N° 844440 | 12/02/2012 22:13:31 | Design by | Gen. en 0.51 sec.