Ciao a tutti, vorrei utilizzare lo script 4111 http://javascript.html.it/script/ved...lling-banners/ in un sito in php ma ho incontrato un problema che non riesco a risolvere.
Allora, ho scaricato l'archivio dal link e ho ottimizzato il codice includendo le funzioni, eliminando il js e adattare il div alla pagina sulla quale dovrà andare (in una cella width="125")
Il codice ottimizzato e funzionante è questo:
Allora, la pagina php che deve contenere questo script è così impostata:codice:<html> <head> <title>Banner scorrevoli</title> <script> function clip() { var contWidth = 125; var contHeight = 800; var id1 = document.getElementById('slideA'); var id2 = document.getElementById('slideB'); var height = id1.offsetHeight; id1.style.top = parseInt(id1.style.top)-1 + 'px'; document.getElementById('slideCont').style.height = contHeight + "px"; document.getElementById('slideCont').style.clip = 'rect(auto,'+ contWidth +'px,' + contHeight +'px,auto)'; id2.style.display = ''; if(parseFloat(id1.style.top) == -(height/2)) {id1.style.top = '0px';} setTimeout(clip,50) } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') {window.onload = func;} else{window.onload = function() {if (oldonload) {oldonload();}func();}} } addLoadEvent(function() {clip();}); </script> </head> <body> <table border="1" width="125" height="800"> <tr> <td width="125"> <div id="slideCont" style="position:relative;z-index:1;width:125px;overflow:hidden;"> <div id="slideA" style="position:absolute;z-index:1;top:0px;left:0px;width:125px;overflow:hidden;"> [img]apache.gif[/img] [img]banner_haan_net_en.gif[/img] [img]linux.gif[/img] [img]mysql.gif[/img] [img]php.gif[/img] [img]ubuntu.gif[/img] <div id="slideB" style="position:relative;z-index:1;top:0px;left:0px;width:125px;overflow:hidden;"> [img]apache.gif[/img] [img]banner_haan_net_en.gif[/img] [img]linux.gif[/img] [img]mysql.gif[/img] [img]php.gif[/img] [img]ubuntu.gif[/img] </div> </div> </div> </td> </tr> </table> </body> </html>
pagina.php
code.phpcodice:<? include("code.php") ;?> <? code1(); ?> <title>titolo</title> <? code2(); ?> <table>contenuto</table> <? code3(); ?>
Il problema è che così le immagini che dovrebbero scorrere non si vedono, non si vedono neanche fisse, tabella vuota.codice:<? function code1() { ?> <html> <head> <meta> <? } function code2() { ?> <style></style> <script>quello di sopra</script> </head> <body> <? } function code3() { ?> qui ci va il table con lo script </body> </html> <? } ?>
Cosa devo fare per risolvere il problema?
Sono giorni che ci lavoro.
Grazie.
Fabrizio.

Rispondi quotando
