Forum-webmaster
Technique - programmation => HTML / CSS / XHTML => Message commencé par: gouteur le le 27-04-2005 a 15:29:53

Titre: diaporama de texte (text slideshow)
Posté par: gouteur le le 27-04-2005 a 15:29:53

bonjour!

comment puis-je modifier le script ci dessous (extrait), pour pouvoir afficher des "messages" successifs de plus d'une ligne sans avoir à ajouter <br> à chaque retour de ligne (je souhaite utiliser des textes mis en forme dans Word)???

--> extrait du script :

------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------

<!-- Begin
var background = "black";
var text = "white";
var URL = "textslideshow.htm"; // change this to the page you want to go to after the slideshow finishes
var speed = 4000; // time in milliseconds (4000 = 4 secs)
var msgcount = 5;

var i = 1;
var blank = " ";

function StringArray (n) {
this.length = n;
for (var x = 1; x <= n; x++) {
this[x] = ' ';
}
}

message = new StringArray(msgcount); // Change the following lines to your own message.
message[1] = "Check out this JavaScript Slideshow!!";
message[2] = "Yet another cool effect that...";
message[3] = "you can easily add to your web pages.";
message[4] = "Why don't you put it on your site?";
message[5] = "Don't forget, there are still<br>lots more scripts to check out!";

------------------------------------------------------------------------
------------------------------------------------------------------------
----------------------------------------------------------------------

Merci pour vos réponses qui je l'espère rendront service au débutant confirmé que je suis!!!!

Titre: Re:diaporama de texte (text slideshow)
Posté par: dhjapan le le 28-04-2005 a 14:27:15

Salut,

en fait je pige pas bien ce que tu veux faire ...

tu peux nous montrer un exemple du resultat que tu cherches ?

Titre: Re:diaporama de texte (text slideshow)
Posté par: gouteur le le 28-04-2005 a 14:52:03

voici d'abord le code complet (à peu près ce que je veux, sauf que je veux plusieurs lignes de texte) Mais je ne veux pas être obligé d'ajouter une balise <br> à chaque retour de ligne (j'ai des textes assez longs)...

Peut-être que je devrais essayer un autre code (qui ouvirait chacun de mes textes .txt dans la même page, à intervalles réguliers, comme s'il s'agissait d'un diaporama foto???)


Code:
<html>
<head>
   <title>Text Slideshow</title>
<script language="JavaScript" type="text/javascript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
// change the colours below if required
var background = "black";
var text = "white";
var URL = "textslideshow.htm"; // change this to the page you want to go to after the slideshow finishes
var speed = 4000; // time in milliseconds (4000 = 4 secs)
var msgcount = 5; // change this to the number of lines in your own message

var i = 1;
var blank = " ";

function StringArray (n) {
this.length = n;
for (var x = 1; x <= n; x++) {
this[x] = ' ';
}
}

message = new StringArray(msgcount); // Change the following lines to your own message.
message[1] = "Check out this JavaScript Slideshow!!";
message[2] = "Yet another cool effect that...";
message[3] = "you can easily add to your web pages.";
message[4] = "Why don't you put it on your site?";
message[5] = "Don't forget, there are still<br>lots more scripts to check out!";

function Slide() {
slidepage = '<body bgcolor='+background+'>'
+ '<center><table border=0 '
+ 'height=100%><tr><td><center><b><font '
+ 'color='+text+' size=6>'+message+'</font></b>'
+ '</center></td></tr></table></center></body>';

if (i == message.length + 1) parent.location = URL;

if (i < message.length + 1) {
frames['slideshow'].location = "javascript:parent.slidepage";
i++;
setTimeout("Slide()",speed);
}
}
// End -->
</script>
</head>
<frameset border="0" rows="100%,*" onload="Slide()">
<frame name="slideshow" src="javascript:parent.blank">
</frameset>
</html>

Titre: Re:diaporama de texte (text slideshow)
Posté par: dhjapan le le 28-04-2005 a 17:48:15

Et si tu fais :

Code:

<html>
<head>
<title>Text Slideshow</title>
<script language="JavaScript" type="text/javascript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
// change the colours below if required
var background = "black";
var text = "white";
var URL = "textslideshow.htm"; // change this to the page you want to go to after the slideshow finishes
var speed = 4000; // time in milliseconds (4000 = 4 secs)
var msgcount = 5; // change this to the number of lines in your own message

var i = 1;
var blank = " ";

function StringArray (n) {
this.length = n;
for (var x = 1; x <= n; x++) {
this[x] = ' ';
}
}

message1 = new StringArray(msgcount); // Change the following lines to your own message.
message1[1] = "Check out this JavaScript Slideshow!!";
message1[2] = "Yet another cool effect that...";
message1[3] = "you can easily add to your web pages.";
message1[4] = "Why don't you put it on your site?";
message1[5] = "Don't forget, there are still<br>lots more scripts to check out!";

message2 = new StringArray(msgcount); // Change the following lines to your own message.
message2[1] = "message 2";
message2[2] = "devrait";
message2[3] = "apparaitre";
message2[4] = "ici";
message2[5] = "voilà !";

function Slide() {
slidepage = '<body bgcolor='+background+'>'
+ '<center><table border=0 '
+ 'height=100%><tr height=50%><td><center><b><font '
+ 'color='+text+' size=6>'+message1+'</font></b>'
+ '</center></td></tr><tr height=50%><td><center><b><font '
+ 'color='+text+' size=6>'+message2+'</font></b>'
+ '</center></td></tr><</table></center></body>';

if (i == message1.length + 1) parent.location = URL;

if (i < message1.length + 1) {
frames['slideshow'].location = "javascript:parent.slidepage";
i++;
setTimeout("Slide()",speed);
}
}
// End -->
</script>
</head>
<frameset border="0" rows="100%,*" onload="Slide()">
<frame name="slideshow" src="javascript:parent.blank">
</frameset>
</html>


en gros j'ai dupliquer le liste des messages .. et je l'ai ai affiché séparément .. ca marche ?


Forum-webmaster | Actionné par YaBB SE
© 2001-2003, YaBB SE Dev Team. Tous droits réservés.