Un cordiale saluto a tutti,
voglio inserire lo stesso JavaScript due volte nella stessa pagina html. Conoscendo la regola che dice
script1:<body onload="dothis()">
script2:<body onload="dothat()">
soluzione:
<body onload="dothis();dothat()">
Nel mio caso però questo non risolve il problema. Che modifiche devo fare perchè funzionino ambedue i script?
Grazie!
Qui sotto vi scrivo il codice intero dello script.
------------------------------------------------------------
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
// change this to where you store the blank.gif image
var blank = "http://www.mysite.com/blank.gif";
topedge = 130; // location of news box from top of page
leftedge = 10; // location of news box from left edge
boxheight = 150; // height of news box
boxwidth = 210; // width of news box
scrollheight = 240; // total height of all data to be scrolled
function scrollnews(cliptop) {
if (document.layers) {
newsDiv = document.news;
newsDiv.clip.top = cliptop;
newsDiv.clip.bottom = cliptop + boxheight;
newsDiv.clip.left = 0;
newsDiv.clip.right = boxwidth + leftedge;
newsDiv.left = leftedge;
newsDiv.top = topedge - cliptop;
}
else {
newsDiv = news.style;
newsDiv.clip = "rect(" + cliptop + "px " + (boxwidth + leftedge) + "px " + (cliptop + boxheight) + "px 0px)";
newsDiv.pixelLeft = leftedge;
newsDiv.pixelTop = topedge - cliptop;
}
cliptop = (cliptop + 1) % (scrollheight + boxheight);
newsDiv.visibility='visible';
setTimeout("scrollnews(" + cliptop + ")", 150);
}
// End -->
</script>
</head>
<body OnLoad="scrollnews(0)">
<div ID="news" style="position:absolute; visibility:hidden;
top:1; left:1; height:600;
clip:rect(10,100,100,10); border-width:0px;">
<table border=0 cellpadding=1 cellspacing=0 bgcolor="white">
<tr>
<td>
<script language="javascript">
document.write('[img] + blank + [/img]');
</script>
</td>
</tr>
<tr>
<td>
Testo 1
Testo 2
Testo 3
Testo 4
Testo 5
Testo 6
xxxxxx@hotmail.com
</td>
</tr>
<tr>
<td>
<script language="javascript">
document.write('[img] + blank + [/img]');
</script>
</td>
</tr>
</table>
</div>