Bonjour, je vous montre mon code tout d'abord:
.aspx
et le .js
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 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body > <form id="form1" runat="server"> <div id="TICKERLOW" style="overflow:hidden; width:500px"><asp:Label id="lbl_tickerLow" runat="server" /></div> <div id="TICKERMEDIUM" style="overflow:hidden; width:500px"><asp:Label id="lbl_tickerMedium" runat="server" /></div> <div id="TICKERHIGH" style="overflow:hidden; width:500px"><asp:Label id="lbl_tickerHigh" runat="server" /></div> </form> <script type="text/javascript" src="webticker_lib.js" language="javascript" onload="ticker_start('TICKERMEDIUM')"></script> <!--<script type="text/javascript" src="webticker_lib.js" language="javascript" onload="ticker_startMedium()"></script> <script type="text/javascript" src="webticker_lib.js" language="javascript" onload="ticker_startHigh()"></script>--> </body> </html>
Ce code servant à afficher différents bandeau contenant des informations provenant d'une base Oracle (exemple: http://www.fotosearch.com/FSE441/x13856029/)
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 function ticker_start(div) { TICKER_CONTENT = document.getElementById(div).innerHTML; TICKER_RIGHTTOLEFT = false; TICKER_SPEED = 2; TICKER_PAUSED = false; var tickerSupported = false; TICKER_WIDTH = document.getElementById(div).style.width; // Firefox if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Safari") != -1) { document.getElementById(div).innerHTML = "<TABLE cellspacing='0' cellpadding='0' width='100%'><TR><TD nowrap='nowrap'><SPAN ID='TICKER_BODY' width='100%'> </SPAN></TD></TR></TABLE>"; tickerSupported = true; } if (!tickerSupported) document.getElementById(div).outerHTML = ""; else { document.getElementById(div).scrollLeft = TICKER_RIGHTTOLEFT ? document.getElementById(div).scrollWidth - document.getElementById(div).offsetWidth : 0; document.getElementById("TICKER_BODY").innerHTML = TICKER_CONTENT; document.getElementById(div).style.display = "block"; TICKER_tick(div); } } function TICKER_tick(div) { if (!TICKER_PAUSED) document.getElementById(div).scrollLeft += TICKER_SPEED * (TICKER_RIGHTTOLEFT ? -1 : 1); if (TICKER_RIGHTTOLEFT && document.getElementById(div).scrollLeft <= 0) document.getElementById(div).scrollLeft = document.getElementById(div).scrollWidth - document.getElementById(div).offsetWidth; if (!TICKER_RIGHTTOLEFT && document.getElementById(div).scrollLeft >= document.getElementById(div).scrollWidth - document.getElementById(div).offsetWidth) document.getElementById(div).scrollLeft = 0; setTimeout("TICKER_tick('"+div+"')", 30); }
Mais je ne sais pas comment appeler une seule et unique fois ma fonction ticker_start(). Cad remplacer le "TICKERMEDIUM" appelé dans la page .aspx par une variable ou autre, permettant de différencier les div...
Pourriez vous m'aider s'il vous plait?
Cordialement,![]()
Partager