Validazione javascript

sambo

Utente Attivo
3 Apr 2012
72
0
0
Grazie a tutti per l'aiuto che mi avete fornito :)
Adesso lo script è validato e funzionante al 100%

A presto :fonzie:
 

sambo

Utente Attivo
3 Apr 2012
72
0
0
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:
 

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.607
54
48
TN
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>
 

sambo

Utente Attivo
3 Apr 2012
72
0
0
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:
 

Vale2

Utente Attivo
28 Mag 2006
446
0
0
Livorno
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.
 

sambo

Utente Attivo
3 Apr 2012
72
0
0
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:
 

sambo

Utente Attivo
3 Apr 2012
72
0
0
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>
 

sambo

Utente Attivo
3 Apr 2012
72
0
0
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
Autore Titolo Forum Risposte Data
K Come eliminare attributi regex per validazione con javascript Javascript 0
MarcoGrazia [Javascript] Regex per la validazione di un numero di telefono. Javascript 2
D Validazione password javascript non fuziona Javascript 7
A funzione javascript per validazione form Javascript 3
C Validazione Bootstrap PHP 0
MarcoGrazia Validazione remota tramite plugin (jquery validate) Snippet Javascript 0
D Form validazione Javascript 2
A Mantenere la validazione reindirizzandoci su un secondo sito WEb. (ASP.NET) ASP.NET 0
E Validazione campi form passati da link Programmazione 0
MarcoGrazia Validazione forum con jquery.validate jQuery 2
K [PHP] Validazione email e password PHP 1
Samuele Ronzani [PHP] Validazione e invio campi form. PHP 7
G validazione form con div tipo alert jQuery 0
I Libreria di validazione e sanitizzazione PHP 0
G Validazione indirizzo mail PHP 1
M Validazione documenti HTML5 HTML e CSS 0
asevenx validazione W3C con errore utf-8 HTML e CSS 3
P Campo select e validazione conjs Javascript 0
radioButton Problemi validazione con jQuery validation jQuery 0
novello88 Validazione modulo non funziona Javascript 1
C Css id univoco e validazione w3c HTML e CSS 1
radioButton validazione input tipo radio Javascript 2
H Problema validazione CAPTCHA PHP 20
P problemi di validazione asincronizzazione dati PHP 7
asevenx errore da risolvere per validazione W3C HTML e CSS 3
S Validazione W3C HTML e CSS 1
E Validazione dei caratteri di una stringa con preg_match PHP 0
criric Validazione form php ajax Snippet PHP 4
D Come creare validazione form istantanea?? Javascript 1
N Validazione form e select dinamica Javascript 5
A Problema validazione w3c HTML e CSS 2
A Validazione w3c warnings HTML e CSS 1
S Form PHP e validazione con ritorno di parametro PHP 0
P problema validazione form con ajax e jquery Ajax 0
D Problema nella validazione di un form con JQUERY ed AjAX jQuery 4
A Problema di validazione W3C HTML e CSS 1
JellyBelly Strutturare un database di tipo questionario - gestione della validazione PHP 5
S Validazione xhtml (onload - embed) HTML e CSS 0
M Symfony2 validazione ajax PHP 0
S Validazione css lightbox2 HTML e CSS 4
S Validazione css lightbox2 CMS (Content Management System) 0
C problema link con ul e li e validazione pagina HTML e CSS 6
M Livevalidation: applicare validazione solo se si sceglie una option di una select. Javascript 0
renoir09 wordpress, validazione, segno "&" WordPress 0
renoir09 wordpress e validazione WordPress 6
E Variabile Superglobale $_REQUEST e Validazione Input Forum Utente PHP 1
G problema con plugin validazione form jquery jQuery 0
G validazione w3c del mio sito web HTML e CSS 3
F Validazione w3c con ip NON pubblico HTML e CSS 2
neo996sps Errore validazione su index PHP 2

Discussioni simili