time

Ερωτήσεις και απαντήσεις σχετικές με την HTML, XHTML και την κατασκευή σελίδων για το Web.

Συντονιστές: WebDev Moderators, Super-Moderators

Απάντηση
Άβαταρ μέλους
George_Z
Δημοσιεύσεις: 60
Εγγραφή: 18 Δεκ 2003 01:27
Τοποθεσία: lefkas

time

Δημοσίευση από George_Z » 19 Φεβ 2004 23:37

1)pws mporw na valw thn wra na fenetai sto dikth tou mouse otan kapoios episkeptetai thn selida mou?
2)ginetai na exw kai mia mikrh eikona? :-?

Άβαταρ μέλους
veriotis
Graphics Moderator
Δημοσιεύσεις: 1360
Εγγραφή: 22 Δεκ 2003 21:30
Τοποθεσία: Βέροια
Επικοινωνία:

time

Δημοσίευση από veriotis » 20 Φεβ 2004 11:32

gia tin ora

Κώδικας: Επιλογή όλων

//**************************************
// Name: Javascript Clock Mouse Trail
// Description:Creates a clock and spiraling Date which follows your mouse on a web page.
// By: Gordon Asbach
//
//
// Inputs:None
//
// Returns:None
//
//Assumes:None
//
//Side Effects:None
//This code is copyrighted and has limited warranties.
//Please see http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.2668/lngWId.2/qx/vb/scripts/ShowCode.htm
//for details.
//**************************************

<HTML>
<HEAD>
</HEAD>
<BODY>
<SCRIPT language=JavaScript>
//Submitted to PSC by Gordon Asbach
//of VBSale.com
dCol='000000';//date colour.
fCol='000000';//face colour.
sCol='000000';//seconds colour.
mCol='000000';//minutes colour.
hCol='000000';//hours colour.
ClockHeight=40;
ClockWidth=40;
ClockFromMouseY=0;
ClockFromMouseX=100;
//Alter nothing below! Alignments will be lost!
d=new Array&#40;"SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"&#41;;
m=new Array&#40;"JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"&#41;;
date=new Date&#40;&#41;;
day=date.getDate&#40;&#41;;
year=date.getYear&#40;&#41;;
if &#40;year < 2000&#41; year=year+1900;
TodaysDate=" "+d&#91;date.getDay&#40;&#41;&#93;+" "+day+" "+m&#91;date.getMonth&#40;&#41;&#93;+" "+year;
D=TodaysDate.split&#40;''&#41;;
H='...';
H=H.split&#40;''&#41;;
M='....';
M=M.split&#40;''&#41;;
S='.....';
S=S.split&#40;''&#41;;
Face='1 2 3 4 5 6 7 8 9 10 11 12';
font='Arial';
size=1;
speed=0.6;
ns=&#40;document.layers&#41;;
ie=&#40;document.all&#41;;
Face=Face.split&#40;' '&#41;;
n=Face.length;
a=size*10;
ymouse=0;
xmouse=0;
scrll=0;
props="<font face="+font+" size="+size+" color="+fCol+"><B>";
props2="<font face="+font+" size="+size+" color="+dCol+"><B>";
Split=360/n;
Dsplit=360/D.length;
HandHeight=ClockHeight/4.5
HandWidth=ClockWidth/4.5
HandY=-7;
HandX=-2.5;
scrll=0;
step=0.06;
currStep=0;
y=new Array&#40;&#41;;x=new Array&#40;&#41;;Y=new Array&#40;&#41;;X=new Array&#40;&#41;;
for &#40;i=0; i < n; i++&#41;&#123;y&#91;i&#93;=0;x&#91;i&#93;=0;Y&#91;i&#93;=0;X&#91;i&#93;=0&#125;
Dy=new Array&#40;&#41;;Dx=new Array&#40;&#41;;DY=new Array&#40;&#41;;DX=new Array&#40;&#41;;
for &#40;i=0; i < D.length; i++&#41;&#123;Dy&#91;i&#93;=0;Dx&#91;i&#93;=0;DY&#91;i&#93;=0;DX&#91;i&#93;=0&#125;


    if &#40;ns&#41;&#123;
    for &#40;i=0; i < D.length; i++&#41;
    document.write&#40;'<layer name="nsDate'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props2+D&#91;i&#93;+'</font></center></layer>'&#41;;
    for &#40;i=0; i < n; i++&#41;
    document.write&#40;'<layer name="nsFace'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props+Face&#91;i&#93;+'</font></center></layer>'&#41;;
    for &#40;i=0; i < S.length; i++&#41;
    document.write&#40;'<layer name=nsSeconds'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+sCol+'><center><b>'+S&#91;i&#93;+'</b></center></font></layer>'&#41;;
    for &#40;i=0; i < M.length; i++&#41;
    document.write&#40;'<layer name=nsMinutes'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+mCol+'><center><b>'+M&#91;i&#93;+'</b></center></font></layer>'&#41;;
    for &#40;i=0; i < H.length; i++&#41;
    document.write&#40;'<layer name=nsHours'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+hCol+'><center><b>'+H&#91;i&#93;+'</b></center></font></layer>'&#41;;
&#125;


    if &#40;ie&#41;&#123;
    document.write&#40;'<div id="Od" style="position&#58;absolute;top&#58;0px;left&#58;0px"><div style="position&#58;relative">'&#41;;
    for &#40;i=0; i < D.length; i++&#41;
    document.write&#40;'<div id="ieDate" style="position&#58;absolute;top&#58;0px;left&#58;0;height&#58;'+a+';width&#58;'+a+';text-align&#58;center">'+props2+D&#91;i&#93;+'</B></font></div>'&#41;;
    document.write&#40;'</div></div>'&#41;;
    document.write&#40;'<div id="Of" style="position&#58;absolute;top&#58;0px;left&#58;0px"><div style="position&#58;relative">'&#41;;
    for &#40;i=0; i < n; i++&#41;
    document.write&#40;'<div id="ieFace" style="position&#58;absolute;top&#58;0px;left&#58;0;height&#58;'+a+';width&#58;'+a+';text-align&#58;center">'+props+Face&#91;i&#93;+'</B></font></div>'&#41;;
    document.write&#40;'</div></div>'&#41;;
    document.write&#40;'<div id="Oh" style="position&#58;absolute;top&#58;0px;left&#58;0px"><div style="position&#58;relative">'&#41;;
    for &#40;i=0; i < H.length; i++&#41;
    document.write&#40;'<div id="ieHours" style="position&#58;absolute;width&#58;16px;height&#58;16px;font-family&#58;Arial;font-size&#58;16px;color&#58;'+hCol+';text-align&#58;center;font-weight&#58;bold">'+H&#91;i&#93;+'</div>'&#41;;
    document.write&#40;'</div></div>'&#41;;
    document.write&#40;'<div id="Om" style="position&#58;absolute;top&#58;0px;left&#58;0px"><div style="position&#58;relative">'&#41;;
    for &#40;i=0; i < M.length; i++&#41;
    document.write&#40;'<div id="ieMinutes" style="position&#58;absolute;width&#58;16px;height&#58;16px;font-family&#58;Arial;font-size&#58;16px;color&#58;'+mCol+';text-align&#58;center;font-weight&#58;bold">'+M&#91;i&#93;+'</div>'&#41;;
    document.write&#40;'</div></div>'&#41;
    document.write&#40;'<div id="Os" style="position&#58;absolute;top&#58;0px;left&#58;0px"><div style="position&#58;relative">'&#41;;
    for &#40;i=0; i < S.length; i++&#41;
    document.write&#40;'<div id="ieSeconds" style="position&#58;absolute;width&#58;16px;height&#58;16px;font-family&#58;Arial;font-size&#58;16px;color&#58;'+sCol+';text-align&#58;center;font-weight&#58;bold">'+S&#91;i&#93;+'</div>'&#41;;
    document.write&#40;'</div></div>'&#41;
&#125;
&#40;ns&#41;?window.captureEvents&#40;Event.MOUSEMOVE&#41;&#58;0;


    function Mouse&#40;evnt&#41;&#123;
    ymouse = &#40;ns&#41;?evnt.pageY+ClockFromMouseY-&#40;window.pageYOffset&#41;&#58;event.y+ClockFromMouseY;
    xmouse = &#40;ns&#41;?evnt.pageX+ClockFromMouseX&#58;event.x+ClockFromMouseX;
&#125;
&#40;ns&#41;?window.onMouseMove=Mouse&#58;document.onmousemove=Mouse;


    function ClockAndAssign&#40;&#41;&#123;
    time = new Date &#40;&#41;;
    secs = time.getSeconds&#40;&#41;;
    sec = -1.57 + Math.PI * secs/30;
    mins = time.getMinutes&#40;&#41;;
    min = -1.57 + Math.PI * mins/30;
    hr = time.getHours&#40;&#41;;
    hrs = -1.575 + Math.PI * hr/6+Math.PI*parseInt&#40;time.getMinutes&#40;&#41;&#41;/360;


        if &#40;ie&#41;&#123;
        Od.style.top=window.document.body.scrollTop;
        Of.style.top=window.document.body.scrollTop;
        Oh.style.top=window.document.body.scrollTop;
        Om.style.top=window.document.body.scrollTop;
        Os.style.top=window.document.body.scrollTop;
    &#125;


        for &#40;i=0; i < n; i++&#41;&#123;
        var F=&#40;ns&#41;?document.layers&#91;'nsFace'+i&#93;&#58;ieFace&#91;i&#93;.style;
        F.top=y&#91;i&#93; + ClockHeight*Math.sin&#40;-1.0471 + i*Split*Math.PI/180&#41;+scrll;
        F.left=x&#91;i&#93; + ClockWidth*Math.cos&#40;-1.0471 + i*Split*Math.PI/180&#41;;
    &#125;


        for &#40;i=0; i < H.length; i++&#41;&#123;
        var HL=&#40;ns&#41;?document.layers&#91;'nsHours'+i&#93;&#58;ieHours&#91;i&#93;.style;
        HL.top=y&#91;i&#93;+HandY+&#40;i*HandHeight&#41;*Math.sin&#40;hrs&#41;+scrll;
        HL.left=x&#91;i&#93;+HandX+&#40;i*HandWidth&#41;*Math.cos&#40;hrs&#41;;
    &#125;


        for &#40;i=0; i < M.length; i++&#41;&#123;
        var ML=&#40;ns&#41;?document.layers&#91;'nsMinutes'+i&#93;&#58;ieMinutes&#91;i&#93;.style;
        ML.top=y&#91;i&#93;+HandY+&#40;i*HandHeight&#41;*Math.sin&#40;min&#41;+scrll;
        ML.left=x&#91;i&#93;+HandX+&#40;i*HandWidth&#41;*Math.cos&#40;min&#41;;
    &#125;


        for &#40;i=0; i < S.length; i++&#41;&#123;
        var SL=&#40;ns&#41;?document.layers&#91;'nsSeconds'+i&#93;&#58;ieSeconds&#91;i&#93;.style;
        SL.top=y&#91;i&#93;+HandY+&#40;i*HandHeight&#41;*Math.sin&#40;sec&#41;+scrll;
        SL.left=x&#91;i&#93;+HandX+&#40;i*HandWidth&#41;*Math.cos&#40;sec&#41;;
    &#125;


        for &#40;i=0; i < D.length; i++&#41;&#123;
        var DL=&#40;ns&#41;?document.layers&#91;'nsDate'+i&#93;&#58;ieDate&#91;i&#93;.style;
        DL.top=Dy&#91;i&#93; + ClockHeight*1.5*Math.sin&#40;currStep+i*Dsplit*Math.PI/180&#41;+scrll;
        DL.left=Dx&#91;i&#93; + ClockWidth*1.5*Math.cos&#40;currStep+i*Dsplit*Math.PI/180&#41;;
    &#125;
    currStep-=step;
&#125;


    function Delay&#40;&#41;&#123;
    scrll=&#40;ns&#41;?window.pageYOffset&#58;0;
    Dy&#91;0&#93;=Math.round&#40;DY&#91;0&#93;+=&#40;&#40;ymouse&#41;-DY&#91;0&#93;&#41;*speed&#41;;
    Dx&#91;0&#93;=Math.round&#40;DX&#91;0&#93;+=&#40;&#40;xmouse&#41;-DX&#91;0&#93;&#41;*speed&#41;;


        for &#40;i=1; i < D.length; i++&#41;&#123;
        Dy&#91;i&#93;=Math.round&#40;DY&#91;i&#93;+=&#40;Dy&#91;i-1&#93;-DY&#91;i&#93;&#41;*speed&#41;;
        Dx&#91;i&#93;=Math.round&#40;DX&#91;i&#93;+=&#40;Dx&#91;i-1&#93;-DX&#91;i&#93;&#41;*speed&#41;;
    &#125;
    y&#91;0&#93;=Math.round&#40;Y&#91;0&#93;+=&#40;&#40;ymouse&#41;-Y&#91;0&#93;&#41;*speed&#41;;
    x&#91;0&#93;=Math.round&#40;X&#91;0&#93;+=&#40;&#40;xmouse&#41;-X&#91;0&#93;&#41;*speed&#41;;


        for &#40;i=1; i < n; i++&#41;&#123;
        y&#91;i&#93;=Math.round&#40;Y&#91;i&#93;+=&#40;y&#91;i-1&#93;-Y&#91;i&#93;&#41;*speed&#41;;
        x&#91;i&#93;=Math.round&#40;X&#91;i&#93;+=&#40;x&#91;i-1&#93;-X&#91;i&#93;&#41;*speed&#41;;
    &#125;
    ClockAndAssign&#40;&#41;;
    setTimeout&#40;'Delay&#40;&#41;',20&#41;;
&#125;
if &#40;ns||ie&#41;window.onload=Delay;
</SCRIPT>
</BODY></HTML>

Απάντηση

Επιστροφή στο “HTML και XHTML”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 2 επισκέπτες