ciao a tutti,
dato il codice in basso non riesco a gestire nessuna posizione sul browser se non il top nello <style>
come mai?
ho provato diverse combinazioni ma niente da fare. dovrei impostare l'altezza del box che visualizza le news a 265px e dovrebbe apparire 14px più in basso del <div id="news">
grazie
codice:
<body onLoad="scrollNews('news', 0);">
<div id="news">
<?php .........
$query = "SELECT id, tipo_struttura, path_strutture, nome FROM tab ORDER BY id desc limit 10";
$result = mysql_query($query) or die (mysql_error());
while ($notizie = mysql_fetch_assoc($result)) {
//echo $notizie['nome'] ."
";
echo "<a href=file.php?path=". $notizie['path_strutture'] .">". $notizie['nome'] ."</a>
";
}
?>
</div>
<style type="text/css">
#news {
position: absolute;
visibility: visible;
top: 20px;
left: 50px;
height: 40px;
width: 150px;
z-index: 10;
clip: rect(0px, 100px, 60px, 0px);
border-width: 0px;
padding-top: 40px;
}
</style>
<script language="JavaScript">
function getObject( obj ) {
var strObj
if ( document.all ) {
strObj = document.all.item( obj );
} else if ( document.getElementById ) {
strObj = document.getElementById( obj );
}
return strObj;
}
var theTop = 20;
var theHeight = 100;
var theWidth = 150;
var theLeft = 650;
var toClip = 55;
function scrollNews( newsDiv, toMove ) {
theDiv = getObject( newsDiv.toString() );
if ( theDiv == null ) { return; }
if ( document.layers ) {
theDiv.clip.top = toMove;
theDiv.clip.bottom = toMove + toClip;
theDiv.top = theTop - toMove;
} else {
theDiv = theDiv.style;
theDiv.clip = "rect(" + toMove + "px " + (theWidth + theLeft) + "px " + (toMove + toClip) + "px 0px)";
theDiv.top = theTop - toMove + 'px';
}
if ( ( theTop + theHeight - toMove ) < ( theTop - theHeight - 20 ) ) {
toMove = 0;
if ( document.layers ) {
theDiv.clip.top = theTop;
theDiv.clip.bottom = toClip;
theDiv.top = theTop
} else {
theDiv.clip = "rect(" + toMove + "px " + (theWidth + theLeft) + "px " + (toMove + toClip) + "px 0px)";
theDiv.top = theTop + 'px';
}
}
toMove = (toMove + 1);
setTimeout("scrollNews('" + newsDiv + "'," + toMove + ")", 100);
}
</script>