Visualizzazione dei risultati da 1 a 3 su 3

Discussione: testo scorrevole

  1. #1

    testo scorrevole

    ciao utilizzo questo script x far scorrere del testo in verticale

    codice:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Completata la sezione STUDI</title>
    <script type="text/javascript">
    	new scrollObject("scr1", 400, 60, "up", 5000, 1.15);
    	new scrollObject("scr2", 468, 60, "left", 3000, 1.5);
    	function scrollObject(main, width, height, direct, pause, speed) {
    	  var self = this;
    	  this.main = main;
    	  this.width = width;
    	  this.height = height;
    	  this.direct = direct;
    	  this.pause = pause;
    	  this.speed = Math.max(1.001, Math.min((direct == "up" || direct == "down") ? height : width, speed));
    	  this.slope = (direct == "up" || direct == "left") ? 1 : -1;
    	  this.prev = this.offset = 0;
    	  this.curr = 1;
    	  this.mouse = false;
    	  this.scroll = function() {
    	    this.main = document.getElementById(this.main);
    	    this.main.style.overflow = "hidden";
    	    this.main.style.position = "relative";
    	    this.main.style.width = this.width + "px";
    	    this.main.style.height = this.height + "px";
    	    var b = [], c;
    	    while (this.main.firstChild) if ((c = this.main.removeChild(this.main.firstChild)).nodeName == "DIV") b.push(c);
    	    for (var x = 0; x < b.length; x++) {
    	      var table = document.createElement('table');
    	          table.cellPadding = table.cellSpacing = table.border = "0";
       	          table.style.background = "#ffffff";
    	          table.style.position = "absolute";
    	          table.style.left = table.style.top = "0px";
    	          table.style.width = table.style.height = "100%";
    	          table.style.overflow = table.style.visibility = "hidden";
    	        var tbody = document.createElement('tbody');
    	          var tr = document.createElement('tr');
    	            var td = document.createElement('td');
    	              while (b[x].firstChild)
    	                  td.appendChild(b[x].removeChild(b[x].firstChild));
    	              tr.appendChild(td);
    	            tbody.appendChild(tr);
    	          table.appendChild(tbody);
    	      this.main.appendChild(table);
    	    } b = c = null;
    	    if (this.main.childNodes.length > 1) {
    	      this.main.onmouseover = function() { self.mouse = true; };
    	      this.main.onmouseout = function() { self.mouse = false; };
    	      setInterval(function() {
    	        if (!self.offset && self.scrollLoop()) self.main.childNodes[self.curr].style.visibility = "visible";
    	      }, this.pause);
    	    } this.main.childNodes[this.prev].style.visibility = "visible";
    	  };
    	  this.scrollLoop = function() {
    	    if (!this.offset) {
    	      if (this.mouse) return false;
    	      this.offset = (this.direct == "up" || this.direct == "down") ? this.height : this.width;
    	    } else this.offset = Math.floor(this.offset / this.speed);
    	    if (this.direct == "up" || this.direct == "down") {
    	      this.main.childNodes[this.curr].style.top = (this.offset * this.slope) + "px";
    	      this.main.childNodes[this.prev].style.top = ((this.offset - this.height) * this.slope) + "px";
    	    } else {
    	      this.main.childNodes[this.curr].style.left = (this.offset * this.slope) + "px";
    	      this.main.childNodes[this.prev].style.left = ((this.offset - this.width) * this.slope) + "px";
    	    }
    	    if (!this.offset) {
    	      this.main.childNodes[this.prev].style.visibility = "hidden";
    	      this.prev = this.curr;
    	      if (++this.curr >= this.main.childNodes.length) this.curr = 0;
    	    } else setTimeout(function() { self.scrollLoop(); }, 30);
    	    return true;
    	  };
    	  if (window.addEventListener) {
    	    window.addEventListener('load', function() { self.scroll(); }, false); 
    	  } else if (window.attachEvent)
    	    window.attachEvent('onload', function() { self.scroll(); });
    	}
    </script>
    <style type="text/css">
    	.scr1 div {
    		visibility:hidden;
    	}
    	.scr1, #scr1 div.default {
    		overflow:hidden;
    		visibility:visible;
    	}
    	.scr1 table tr td div {
    		visibility:visible;
    	}
    	.scr1 {
    		margin:0px;
    	}
    </style>
    </head>
    <body>
    	<div id="scr1" style="background-color:white">
    		<div class="default" style="background-color:white">Completata la sezione STUDI.</div>
    		<div style="background-color:white">A breve saranno disponibili tutti i sermoni in formato audio.</div>
    		<div style="background-color:white">La sezione dedicata agli utenti non è ancora attiva.</div>
    		<div style="background-color:white">Completata la sezione Volantini & Opuscoli (20/06/08).</div>
    		<div style="background-color:white">Disponibile la sezione immagini.</div>
    		<div style="background-color:white">Completata la sezione libri e rubriche</div>
    		<div style="background-color:white">-</div>
    		<div style="background-color:white"><span style="background-color:#FFFF00">Questo sito è ancora in fase di costruzione! A breve saranno disponibili tutte le sezioni!</span></div>
    		<div style="background-color:white">[img]images/gdg1.gif[/img]</div>
    	</div>
    </body>
    </html>

    ma mi da il seguente errore:

    LINEA 24 CARATTERE 6
    ERRORE: NESSUN OGGETTO

    ma nn riesco a capire xkè....
    mi aiutate x favore?
    grazie

  2. #2
    Utente di HTML.it L'avatar di byaur
    Registrato dal
    Aug 2004
    Messaggi
    1,061
    alla linea 6 tu fai questo
    new scrollObject("scr2", 468, 60, "left", 3000, 1.5);


    ma sotto hai solo
    <div id="scr1"...>....</div>

    il problema potrebbe essere l'assenza dell'elemento sul quale crei l'oggetto.
    Chi di noi non vorrebbe
    sollevare il velo sotto cui sta nascosto il
    futuro...
    David Hilbert

  3. #3

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.