Problema con javascript SCROLLING BANNERS implementato in pagina php

badbrizio

Nuovo Utente
17 Giu 2007
23
0
0
Ciao a tutti, vorrei utilizzare lo script nei tag code in un sito in php ma ho incontrato un problema che non riesco a risolvere.
Allora, il codice è questo, funziona, se lo provate è ok.

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;">
    					<a href="#"><img src="1.gif" border="0"></a><br><br>
					<a href="#"><img src="2.gif" border="0"></a><br><br>
    					<a href="#"><img src="3.gif" border="0"></a><br><br>
    					<a href="#"><img src="4.gif" border="0"></a><br><br>
    					<a href="#"><img src="5.gif" border="0"></a><br><br>
    					<a href="#"><img src="6.gif" border="0"></a><br><br>
    					<div id="slideB" style="position:relative;z-index:1;top:0px;left:0px;width:125px;overflow:hidden;">
      						<a href="#"><img src="1.gif" border="0"></a><br><br>
      						<a href="#"><img src="2.gif" border="0"></a><br><br>
      						<a href="#"><img src="3.gif" border="0"></a><br><br>
      						<a href="#"><img src="4.gif" border="0"></a><br><br>
      						<a href="#"><img src="5.gif" border="0"></a><br><br>
      						<a href="#"><img src="6.gif" border="0"></a><br><br>
    					</div>
  					</div>
				</div>
			</td>
		</tr>
	</table>
</body>
</html>

Allora, la pagina php che deve contenere questo script è così impostata:

pagina.php
Codice:
<? include("code.php") ;?>
<? code1(); ?>
<title>titolo</title>
<? code2(); ?>
<table>contenuto</table>
<? code3(); ?>

code.php
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>
<? } ?>
Il problema è che così le immagini che dovrebbero scorrere non si vedono, non si vedono neanche fisse, tabella vuota.
Cosa devo fare per risolvere il problema?
Sono giorni che ci lavoro.
Grazie.
Fabrizio.
 
Ok, sono riuscito a trovare il problema ... era nel body onload di un menu che andava messo in function addLoadEvent(func)
 

Discussioni simili