|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Mar 2007
Città: Pescara
Messaggi: 586
|
Problema con javascript, funziona ma non in pagina php
Ciao a tutti, spero di aver postato nella sezione giusta ... 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>
pagina.php Codice:
<? include("code.php") ;?>
<? code1(); ?>
<title>titolo</title>
<? code2(); ?>
<table>contenuto</table>
<? code3(); ?>
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 ma non riesco a trovare iuna soluzione, spero che qualcuno possa gentilmente aiutarmi. Grazie. Fabrizio.
__________________
Asrock 890GX Extreme3 | AMD Phenom II X4 965 BE | Sapphire Radeon HD5850 Toxic 1GB | 2x4GB 1600MHz CL9 Corsair Vengeance LP | Corsair 750HXEU | SSD Samsung 830 256GB | Samsung Syncmaster P2470H | Scythe Mugen 2B | Antec 300 | Creative X-FI Titanium | Creative Fatal1ty HS800 Ultima modifica di badbrizio : 19-10-2010 alle 13:28. |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Mar 2007
Città: Pescara
Messaggi: 586
|
Ok, sono riuscito a trovare il problema ... era nel body onload di un menu che andava messo in function addLoadEvent(func)
__________________
Asrock 890GX Extreme3 | AMD Phenom II X4 965 BE | Sapphire Radeon HD5850 Toxic 1GB | 2x4GB 1600MHz CL9 Corsair Vengeance LP | Corsair 750HXEU | SSD Samsung 830 256GB | Samsung Syncmaster P2470H | Scythe Mugen 2B | Antec 300 | Creative X-FI Titanium | Creative Fatal1ty HS800 |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 04:11.



















