Validazione javascript

  • Creatore Discussione Creatore Discussione sambo
  • Data di inizio Data di inizio
Grazie a tutti per l'aiuto che mi avete fornito :-)
Adesso lo script è validato e funzionante al 100%

A presto :fonzie:
 
Adesso che grazie a voi, ho ottenuto uno script validato e funzionante, vorrei evitare di andare a cercarne altri e magari modificare l'attuale per le mie necessità. Spero in un vostro aiuto.

Dallo script attuale, avrei bisogno di aggiungere due modalità di esecuzione nel testo in movimento.

- Vorrei, se possibile, fare in modo che il testo scorra verticalmente. E' possibile ottenere questo, utilizzando lo stesso script?

- Vorrei fare in modo che quando il mouse finisca sopra il testo, questo si fermi.

Sono due piccole funzioni che sono presenti anche in altri script, ma essendo questo, già pronto per l'uso, vorrei modificarlo.

Mi potete aiutare?

Grazie e buona Pasqua a tutti :byebye:
 
Ciao,
- Vorrei fare in modo che quando il mouse finisca sopra il testo, questo si fermi.

Puoi fare cosi:
usando il metodo clearTimeout();
Ho ripreso il codice che avevi messo nel post #10 (mi pare)

cmq

ho aggiunto la funzione stop() e due eventi nel tag input
ho mo dificato leggermente la funzione scrolling

HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Documento senza titolo</title>
        <script type="text/javascript">
            var scroll = " Testo in movimento ";
            function scrolling() {
                scroll = scroll.substring(1, scroll.length) + scroll.substring(0, 1);
                document.form_scroll.scroll_txt.value = scroll;
                s = setTimeout("scrolling()", 80);
            }
            function stop() {
                clearTimeout(s);
            }
            //--></script>

    </head>
    <body onload="scrolling()">
        <p>&nbsp;</p>
        <table width="800" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td width="809" >                    
                    <form name="form_scroll">
                        <input onmouseout="scrolling()" onmouseover="stop()" type="text" name="scroll_txt" size="100" style="font-family: Courier, monospace; text-align: left" />
                    </form>
                </td>
            </tr>
        </table>
        <p>&nbsp;</p>
    </body>
</html>
 
Ciao,


Puoi fare cosi:
usando il metodo clearTimeout();
Ho ripreso il codice che avevi messo nel post #10 (mi pare)

cmq

ho aggiunto la funzione stop() e due eventi nel tag input
ho mo dificato leggermente la funzione scrolling

HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Documento senza titolo</title>
        <script type="text/javascript">
            var scroll = " Testo in movimento ";
            function scrolling() {
                scroll = scroll.substring(1, scroll.length) + scroll.substring(0, 1);
                document.form_scroll.scroll_txt.value = scroll;
                s = setTimeout("scrolling()", 80);
            }
            function stop() {
                clearTimeout(s);
            }
            //--></script>

    </head>
    <body onload="scrolling()">
        <p>&nbsp;</p>
        <table width="800" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td width="809" >                    
                    <form name="form_scroll">
                        <input onmouseout="scrolling()" onmouseover="stop()" type="text" name="scroll_txt" size="100" style="font-family: Courier, monospace; text-align: left" />
                    </form>
                </td>
            </tr>
        </table>
        <p>&nbsp;</p>
    </body>
</html>

Ciao criric, grazie per il tuo aiuto.
La funzione che mi ha scritto funziona perfettamente e mi consente di raggiungere il mio scopo.(Fermare il testo al passaggio del mouse)
Riguardo la possibilità di modificare questo script, passando dal testo in movimento orrizontale al verticale, mi puoi dire qualcosa?

Grazie :byebye:
 
Ciao,

prova questo

Codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Dynamic Drive DHTML Scripts- Cross Browser marquee II</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Click here for a cross browser marquee">
<style type="text/css">

#marqueecontainer{
position: relative;
width: 500px; /*marquee width */
height: 300px; /*marquee height */
background-color: green;
overflow: hidden;
border: 1px solid black;
padding: 5px;
background-color: lightyellow;
padding: 2px;
padding-left: 4px;
}

</style>

<script type="text/javascript">

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=2 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee


</script>
        </head>
<body>
<center>
<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">
Testo Scorrevole ................ Text Scroller<br><br>
Text Scroller ................ Testo Scorrevole<br><br>
<a href="http://forum.mrwebmaster.it/" target="_blank">mr.webmaster forum</a>
</div>
</div>
</center>
</body>
</html>

Valeria.
 
Ciao,

prova questo

Codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Dynamic Drive DHTML Scripts- Cross Browser marquee II</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Click here for a cross browser marquee">
<style type="text/css">

#marqueecontainer{
position: relative;
width: 500px; /*marquee width */
height: 300px; /*marquee height */
background-color: green;
overflow: hidden;
border: 1px solid black;
padding: 5px;
background-color: lightyellow;
padding: 2px;
padding-left: 4px;
}

</style>

<script type="text/javascript">

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=2 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee


</script>
        </head>
<body>
<center>
<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">
Testo Scorrevole ................ Text Scroller<br><br>
Text Scroller ................ Testo Scorrevole<br><br>
<a href="http://forum.mrwebmaster.it/" target="_blank">mr.webmaster forum</a>
</div>
</div>
</center>
</body>
</html>

Valeria.

Grazie per lo scipt Valeria. Io pensavo che bastasse modificare qualche parametro per cambiare la direzione del testo, da orrizontale a verticale.
Mi sembra di capire che sono procedimenti completamente diversi .. Cmq questo script va benissimo per l'effetto verticale, mentre quello procedente lo userò per ottenere quello orrizontale. Nella validazione html mi ha riportato diversi errori, ma seguendo i vostri consigli, nei post precedenti, sono riuscito a sistemare il tutto.

Grazie a tutti per l'aiuto che mi avete dato.

Ciao :byebye:
 
Scusate se ritorno al topic dopo circa un mese, però avrei bisogno di aggiungere una piccola funzione a questo script presente su MrWebmaster, segnalatomi gentilmente da Valeria.

Questo che segue è il codice originale dello script. Io vorrei aggiungere uno stop di alcuni secondi al termine di ogni testo inserito.
Un pò come fa lo script all'inzio (attende due secondi prima di scorrere) soltanto che vorrei lo facesse ogni volta che viene inserita una notizia.

Mi potete aiutare?

Grazie :byebye:

Codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Dynamic Drive DHTML Scripts- Cross Browser marquee II</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Click here for a cross browser marquee">
<style type="text/css">

#marqueecontainer{
position: relative;
width: 500px; /*marquee width */
height: 300px; /*marquee height */
background-color: green;
overflow: hidden;
border: 1px solid black;
padding: 5px;
background-color: lightyellow;
padding: 2px;
padding-left: 4px;
}

</style>

<script type="text/javascript">

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=2 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee


</script>
        </head>
<body>
<center>
<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">
Testo Scorrevole ................ Text Scroller<br><br>
Text Scroller ................ Testo Scorrevole<br><br>
<a href="http://forum.mrwebmaster.it/" target="_blank">mr.webmaster forum</a>
</div>
</div>
</center>
</body>
</html>
 
Ciao,

prova questo

Codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Dynamic Drive DHTML Scripts- Cross Browser marquee II</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Click here for a cross browser marquee">
<style type="text/css">

#marqueecontainer{
position: relative;
width: 500px; /*marquee width */
height: 300px; /*marquee height */
background-color: green;
overflow: hidden;
border: 1px solid black;
padding: 5px;
background-color: lightyellow;
padding: 2px;
padding-left: 4px;
}

</style>

<script type="text/javascript">

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=2 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee


</script>
        </head>
<body>
<center>
<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">
Testo Scorrevole ................ Text Scroller<br><br>
Text Scroller ................ Testo Scorrevole<br><br>
<a href="http://forum.mrwebmaster.it/" target="_blank">mr.webmaster forum</a>
</div>
</div>
</center>
</body>
</html>

Valeria.

Ciao Valeria,
mi sono accorto soltanto adesso che lo script che mi hai segnalato non gira correttamente su I.E.
Peccato perchè, dopo averlo personalizzato e validato, mi sembrava essere quello giusto.
Ho cercato su google e ne ho trovati a centinaia, ma nessuno risponde ai miei requisiti.

A me servirebbe uno semplicissimo ed elementare script, che mi consenta di far scorrere il testo in senso verticale con effetto stop al passaggio del mouse .. tutto qui. Sulla rete si trova di tutto, anche cose piu complicate, ma poche funzionano realmente o sono validate.

Qualcun puo aiutarmi?

Grazie :beer:
 

Discussioni simili