Newsgroup: it.comp.lang.javascript
Titolo: Perchè non va?

This is a multi-part message in MIME format.
------=_NextPart_000_0015_01BCEC53.D2974160
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Come mai non funziona?
<SCRIPT LANGUAGE=3D"JavaScript">
 function person_in() {
    enter=3Dnew Date();
 }
 function person_out() {
    exit=3Dnew Date();
    time_dif=3D(exit.getTime()-enter.getTime())/1000;
    time_dif=3DMath.round(time_dif);
    alert ("Sei Stato in questa pagina: " + time_dif + "secondi!! by =
Fabio")
 }
 </SCRIPT>
Rispondetemi via e-mail, per favore. Grazie.
--=20
By            =20
=3D> Fabio <=3D       :o)
fab...@net-one.it
fab...@geocities.com
http://www.geocities.com/SiliconValley/Horizon/5990
http://www.anturio.com/userpage/883forum
***************************************************
* Shift to the left; Shift to the right!              *
* Page Up, Page Down, Bye, Bye, Byte!     *
***************************************************
------=_NextPart_000_0015_01BCEC53.D2974160
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.71.1712.3"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 face=3DArial size=3D2>Come mai non =
funziona?</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;SCRIPT =
LANGUAGE=3D&quot;JavaScript&quot;&gt;<BR>=20
function person_in() {<BR>&nbsp;&nbsp;&nbsp; enter=3Dnew Date();<BR> =
}<BR>=20
function person_out() {<BR>&nbsp;&nbsp;&nbsp; exit=3Dnew=20
Date();<BR>&nbsp;&nbsp;&nbsp;=20
time_dif=3D(exit.getTime()-enter.getTime())/1000;<BR>&nbsp;&nbsp;&nbsp;=20
time_dif=3DMath.round(time_dif);<BR>&nbsp;&nbsp;&nbsp; alert (&quot;Sei =
Stato in=20
questa pagina: &quot; + time_dif + &quot;secondi!! by Fabio&quot;)<BR> =
}<BR>=20
&lt;/SCRIPT&gt;</FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Rispondetemi via e-mail, per favore.=20
Grazie.</FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2><BR>--=20
<BR><BR>By&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
<BR>=3D&gt; Fabio &lt;=3D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
:o)</FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 face=3DArial size=3D2><A=20
href=3D"mailto:
fab...@net-one.it
">
fab...@net-one.it
</A><BR><A=20
href=3D"mailto:
fab...@geocities.com
">
fab...@geocities.com
</A><BR><A=20
href=3D"
http://www.geocities.com/SiliconValley/Horizon/5990
">
http://www.g
=
eocities.com/SiliconValley/Horizon/5990
</A><BR><A=20
href=3D"
http://www.anturio.com/userpage/883forum
">
http://www.anturio.com/=
userpage/883forum</A></FONT></DIV>
<DIV><FONT color=3D#000000 face=3DArial=20
size=3D2>***************************************************<BR>* Shift =
to the=20
left; Shift to the=20
right!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;=20
*<BR>* Page Up, Page Down, Bye, Bye, Byte!&nbsp;&nbsp;&nbsp;&nbsp;=20
*<BR>***************************************************</FONT>&nbsp;</DI=
V></BODY></HTML>
------=_NextPart_000_0015_01BCEC53.D2974160--

questo lo metti dentro <HEAD>:
<SCRIPT LANGUAGE="JavaScript">
var enter="";
var exit="";
function person_in()
{    
enter1=new Date();
enter=enter1.getTime()
}
function person_out()
{
    exit1=new Date();
exit=exit1.getTime();
    time_dif=(exit-enter)/1000;
    time_dif=Math.round(time_dif);
    alert ("Sei Stato in questa pagina: " + time_dif + "secondi!! by
Fabio")
 }
 </SCRIPT>
nel body ci metti il metodo per attivare la funzione dello script:
<body onload="person_in()" onunload="person_out()">
scusa se ti ho stravolto lo script, ma era necessario, avevi mischiato
un po' di variabili.
Ciao.
------------------------------------------------------
          Codename:  Marlboro Man ©
   E-Mail: 
Xmar...@ouverture.it
 
Xmarlb...@bigfoot.com
 
Xmar...@cybermail.net
          | /\ |       ICQ Uin: 2187863
------------------------------------------------------
                · · · Giovanni Ferri · · ·
------------------------------------------------------
        Volontario Croce Rossa Italiana
          Sottocomitato Follonica (GR)
------------------------------------------------------
 ··· Fondatore della Torre del Sapere ···
  †   "I Maghi della gilda dei 
                Guardiani della Sacra Ankh"  †
 
http://www.difnet.com/torre/tdsintro.html
------------------------------------------------------
Per scrivermi, togliere X davanti all'email.