HTLM Code за дата и час

Post Reply
pSh
Нов
Нов
Posts: 4
Joined: Tue Jun 20, 2006 4:17 pm
Location: Bulgaria / Sofia
Contact:

HTLM Code за дата и час

Post by pSh » Tue Jun 20, 2006 4:19 pm

ами по възможност ако има някой, който може да ми каже HTLM Code за дата и час ( ако има такав )

User avatar
NetCutter
Потребител
Потребител
Posts: 1242
Joined: Mon Jan 09, 2006 9:54 am
Location: In Your Hard Drive!!!
Contact:

Post by NetCutter » Tue Jun 20, 2006 4:32 pm

html не е динамичен език,от което следва че не може да показва реално променящи се данни,като час,дата и прочие. . .
Това може да стане с JavaScript или php :wink:
Ако искаш ще ти дам как става и на двата езика :wink:

Admin
Site Admin
Site Admin
Posts: 4
Joined: Thu Jan 01, 1970 12:00 am
Answers: 224

Post by Admin » Tue Jun 20, 2006 4:57 pm

Дай му javascript-a.
Той затова пита.

User avatar
NetCutter
Потребител
Потребител
Posts: 1242
Joined: Mon Jan 09, 2006 9:54 am
Location: In Your Hard Drive!!!
Contact:

Post by NetCutter » Tue Jun 20, 2006 5:11 pm

Еми вече ми ги поиска по ЛС и му дадох два скрипта :wink:

User avatar
NetCutter
Потребител
Потребител
Posts: 1242
Joined: Mon Jan 09, 2006 9:54 am
Location: In Your Hard Drive!!!
Contact:

Post by NetCutter » Tue Jun 20, 2006 5:52 pm

Ето скриптовете:

Code: Select all

<span id="liveclock" style="position&#58;absolute;left&#58;0;top&#58;0;">

</span>



<script language="JavaScript">

 <!--





function show5&#40;&#41;&#123;

if &#40;!document.layers&&!document.all&&!document.getElementById&#41;return

 var Digital=new Date&#40;&#41;

 var hours=Digital.getHours&#40;&#41;

 var minutes=Digital.getMinutes&#40;&#41;

 var seconds=Digital.getSeconds&#40;&#41;

var dn="PM"

if &#40;hours<12&#41;

dn="AM"

if &#40;hours>12&#41;

hours=hours-12

if &#40;hours==0&#41;

hours=12

 if &#40;minutes<=9&#41;

 minutes="0"+minutes

 if &#40;seconds<=9&#41;

 seconds="0"+seconds

myclock="<font size='5' face='Arial' ><b><font size='1'>4asut e&#58;</font></br>"+hours+"&#58;"+minutes+"&#58;"

 +seconds+" "+dn+"</b></font>"

if &#40;document.layers&#41;&#123;

document.layers.liveclock.document.write&#40;myclock&#41;

document.layers.liveclock.document.close&#40;&#41;

&#125;

else if &#40;document.all&#41;

liveclock.innerHTML=myclock

else if &#40;document.getElementById&#41;

document.getElementById&#40;"liveclock"&#41;.innerHTML=myclock

setTimeout&#40;"show5&#40;&#41;",1000&#41;

 &#125;

window.onload=show5

 //-->

 </script>

Code: Select all

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

// skripta e izpraten ot

//Name&#58; Georgi

//Email&#58; house_bg2000@yahoo.com

//za pove4e - http&#58;//todos.zonebg.com/javascript/



fCol = '000000';  //face colour.

sCol = 'ff0000';  //seconds colour.

mCol = '000000';  //minutes colour.

hCol = '000000';  //hours colour.

H = '....';

H = H.split&#40;''&#41;;

M = '.....';

M = M.split&#40;''&#41;;

S = '......';

S = S.split&#40;''&#41;;

Ypos = 0;

Xpos = 0;

Ybase = 8;

Xbase = 8;

dots = 12;

ns = &#40;document.layers&#41;?1&#58;0;

if &#40;ns&#41; &#123;

dgts = '1 2 3 4 5 6 7 8 9 10 11 12';

dgts = dgts.split&#40;' '&#41;;

for &#40;i = 0; i < dots; i++&#41; &#123;

document.write&#40;'<layer name=nsDigits'+i+' top=0 left=0 height=30 width=30><center><font face=Arial,Verdana size=1 color='+fCol+'>'+dgts&#91;i&#93;+'</font></center></layer>'&#41;;

&#125;

for &#40;i = 0; i < M.length; i++&#41; &#123;

document.write&#40;'<layer name=ny'+i+' top=0 left=0 bgcolor='+mCol+' clip="0,0,2,2"></layer>'&#41;;

&#125;

for &#40;i = 0; i < H.length; i++&#41; &#123;

document.write&#40;'<layer name=nz'+i+' top=0 left=0 bgcolor='+hCol+' clip="0,0,2,2"></layer>'&#41;;

&#125;

for &#40;i = 0; i < S.length; i++&#41; &#123;

document.write&#40;'<layer name=nx'+i+' top=0 left=0 bgcolor='+sCol+' clip="0,0,2,2"></layer>'&#41;;

   &#125;

&#125;

else &#123;

document.write&#40;'<div style="position&#58;absolute;top&#58;0px;left&#58;0px"><div style="position&#58;relative">'&#41;;

for &#40;i = 1; i < dots+1; i++&#41; &#123;

document.write&#40;'<div id="ieDigits" style="position&#58;absolute;top&#58;0px;left&#58;0px;width&#58;30px;height&#58;30px;font-family&#58;Arial,Verdana;font-size&#58;10px;color&#58;'+fCol+';text-align&#58;center;padding-top&#58;10px">'+i+'</div>'&#41;;

&#125;

document.write&#40;'</div></div>'&#41;

document.write&#40;'<div 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; &#123;

document.write&#40;'<div id=y style="position&#58;absolute;width&#58;2px;height&#58;2px;font-size&#58;2px;background&#58;'+mCol+'"></div>'&#41;;

&#125;

document.write&#40;'</div></div>'&#41;

document.write&#40;'</div></div>'&#41;

document.write&#40;'<div 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; &#123;

document.write&#40;'<div id=z style="position&#58;absolute;width&#58;2px;height&#58;2px;font-size&#58;2px;background&#58;'+hCol+'"></div>'&#41;;

&#125;

document.write&#40;'</div></div>'&#41;

document.write&#40;'<div 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; &#123;

document.write&#40;'<div id=x style="position&#58;absolute;width&#58;2px;height&#58;2px;font-size&#58;2px;background&#58;'+sCol+'"></div>'&#41;;

&#125;

document.write&#40;'</div></div>'&#41;

&#125;

function clock&#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.57 + Math.PI * hr/6 + Math.PI*parseInt&#40;time.getMinutes&#40;&#41;&#41;/360;

if &#40;ns&#41; &#123;

Ypos = window.pageYOffset+window.innerHeight-60;

Xpos = window.pageXOffset+window.innerWidth-80;

&#125;

else &#123;

Ypos = document.body.scrollTop + window.document.body.clientHeight - 60;

Xpos = document.body.scrollLeft + window.document.body.clientWidth - 60;

&#125;

if &#40;ns&#41; &#123;

for &#40;i = 0; i < dots; ++i&#41;&#123;

document.layers&#91;"nsDigits"+i&#93;.top = Ypos - 5 + 40 * Math.sin&#40;-0.49+dots+i/1.9&#41;;

document.layers&#91;"nsDigits"+i&#93;.left = Xpos - 15 + 40 * Math.cos&#40;-0.49+dots+i/1.9&#41;;

&#125;

for &#40;i = 0; i < S.length; i++&#41;&#123;

document.layers&#91;"nx"+i&#93;.top = Ypos + i * Ybase * Math.sin&#40;sec&#41;;

document.layers&#91;"nx"+i&#93;.left = Xpos + i * Xbase * Math.cos&#40;sec&#41;;

&#125;

for &#40;i = 0; i < M.length; i++&#41;&#123;

document.layers&#91;"ny"+i&#93;.top = Ypos + i * Ybase * Math.sin&#40;min&#41;;

document.layers&#91;"ny"+i&#93;.left = Xpos + i * Xbase * Math.cos&#40;min&#41;;

&#125;

for &#40;i = 0; i < H.length; i++&#41;&#123;

document.layers&#91;"nz"+i&#93;.top = Ypos + i * Ybase * Math.sin&#40;hrs&#41;;

document.layers&#91;"nz"+i&#93;.left = Xpos + i * Xbase * Math.cos&#40;hrs&#41;;

   &#125;

&#125;

else&#123;

for &#40;i=0; i < dots; ++i&#41;&#123;

ieDigits&#91;i&#93;.style.pixelTop = Ypos - 15 + 40 * Math.sin&#40;-0.49+dots+i/1.9&#41;;

ieDigits&#91;i&#93;.style.pixelLeft = Xpos - 14 + 40 * Math.cos&#40;-0.49+dots+i/1.9&#41;;

&#125;

for &#40;i=0; i < S.length; i++&#41;&#123;

x&#91;i&#93;.style.pixelTop = Ypos + i * Ybase * Math.sin&#40;sec&#41;;

x&#91;i&#93;.style.pixelLeft = Xpos + i * Xbase * Math.cos&#40;sec&#41;;

&#125;

for &#40;i=0; i < M.length; i++&#41;&#123;

y&#91;i&#93;.style.pixelTop = Ypos + i * Ybase * Math.sin&#40;min&#41;;

y&#91;i&#93;.style.pixelLeft = Xpos + i * Xbase * Math.cos&#40;min&#41;;

&#125;

for &#40;i=0; i < H.length; i++&#41;&#123;

z&#91;i&#93;.style.pixelTop = Ypos + i * Ybase*Math.sin&#40;hrs&#41;;

z&#91;i&#93;.style.pixelLeft = Xpos + i * Xbase*Math.cos&#40;hrs&#41;;

   &#125;

&#125;

setTimeout&#40;'clock&#40;&#41;', 50&#41;;

&#125;

if &#40;document.layers || document.all&#41; window.onload = clock;

//  End -->

</script>

Admin
Site Admin
Site Admin
Posts: 4
Joined: Thu Jan 01, 1970 12:00 am
Answers: 224

Post by Admin » Tue Jun 20, 2006 5:53 pm

А така! :)

Post Reply