Autor | Zpráva | ||
---|---|---|---|
caesar1987 Profil * |
#1 · Zasláno: 3. 6. 2005, 01:21:01
Z jednej stránky som stiahol script na ukazovanie času a dátumu...Ale mám s ním problém....
Keď súbor otvorím priamo, ide všetko fpoho. Avšak ak ho dám načitať cez <frame>, tak sa mi neukáže čas... kde je chyba??? Toto je script: <script type="text/javascript"> function tick() { var hours, minutes, seconds; var intHours, intMinutes, intSeconds; var today; today = new Date(); intHours = today.getHours(); intMinutes = today.getMinutes(); intSeconds = today.getSeconds(); if (intHours == 0) { hours = "0:"; ap = "Midnight"; } else if (intHours < 12) { hours = intHours+":"; ap = "A.M."; } else if (intHours == 12) { hours = "12:"; ap = "Noon"; } else { intHours = intHours - 0 hours = intHours + ":"; ap = "P.M."; } if (intMinutes < 10) { minutes = "0"+intMinutes+":"; } else { minutes = intMinutes+":"; } if (intSeconds < 10) { seconds = "0"+intSeconds+" "; } else { seconds = intSeconds+" "; } timeString = hours+minutes+seconds; Clock.innerHTML = timeString; window.setTimeout("tick();", 1000); } window.onload = tick; </script> <table border="0" cellpadding="0.1" bgcolor="#1a50b8"> <tr> <td><font color="gold" size="2" face="Westminster">Dnes je: </font></td> <td><font color="gold" size="1" face="MS Sans Serif"><script language="JavaScript" type="text/javascript"><!-- var datum= new Date(); var mesic = datum.getMonth(); mesic++; if (datum.getDay()==0) {document.write('Nedeľa ')} if (datum.getDay()==1) {document.write('Pondelok ')} if (datum.getDay()==2) {document.write('Utorok ')} if (datum.getDay()==3) {document.write('Streda ')} if (datum.getDay()==4) {document.write('Štvrtok ')} if (datum.getDay()==5) {document.write('Piatok ')} if (datum.getDay()==6) {document.write('Sobota ')} document.write(datum.getDate() + ". "+mesic+". "+datum.getYear()) // --></script></font></td> </tr> </table> </center> Skúšal som to len vo firefoxe, tam to nejde, možnoze v IE to ide, ale pre mňa je dôležitý aj firefox... Za každú radu vopred ďakujem... Miloš... |
||
caesar1987 Profil |
#2 · Zasláno: 3. 6. 2005, 01:27:17
a este nieco... v ie mi ukazuje rok normalne.... 2005
ale vo firefoxe 105... v com je chyba??? |
||
peta Profil * |
#3 · Zasláno: 3. 6. 2005, 12:15:14
Ten script je desivy :) Nepomohlo by neco z www.google.com nebo tady z prikladu?
www.jakpsatweb.cz - Javascript - priklady Treba to doplnovani cslic bych resil: original if (intMinutes < 10) { minutes = "0"+intMinutes+":"; } else { minutes = intMinutes+":"; } if (intSeconds < 10) { seconds = "0"+intSeconds+" "; } else { seconds = intSeconds+" "; } timeString = hours+minutes+seconds; moje minutes=(intMinutes<10)?"0":"";minutes+=intMinutes seconds=(intSeconds<10)?"0":"";seconds+=intSeconds timeString = hours+":"+minutes+":"+seconds; Pak tam mas 7x document.write a getday... var i=datum.getDay();var den="" switch (i) case 0:den='Nedeľa ';break; case 1:den='Nedeľa ';break; case 2:den='Nedeľa ';break; case 3:den='Nedeľa ';break; case 4:den='Nedeľa ';break; case 5:den='Nedeľa ';break; case 6:den='Nedeľa ';break; case 7:den='Nedeľa ';break; document.write(den) a vubec cely ten script :) Ted jsem resil souradnice mysky a pouzil jsem stranku, tak tam nekde proklkej http://www.quirksmode.org/js/events_compinfo.html |
||
peta Profil * |
#4 · Zasláno: 3. 6. 2005, 12:16:59
Jo, u switch zavorky :) mozna tam mam jeste nejakou chybku, ale nic, co by se s jakpsatweb nedalo najit :)
switch (i) { case ... case ... } |
||
Časová prodleva: 3 měsíce
|
|||
caesar1987 Profil |
#5 · Zasláno: 12. 9. 2005, 22:51:50
nic nefunguje.....
jednoducho to nejde, som skusal uz 6 roznych zapisov skriptov.... pri normalnom otvoreni stranky to ide, ale pri nacitani cez frame to nejde... :( sakra |
||
peta Profil * |
#6 · Zasláno: 13. 9. 2005, 12:51:52
caesar1987
dobre, udelam si testovaci stranku... |
||
peta Profil * |
#7 · Zasláno: 13. 9. 2005, 13:47:11
No jo, ale kde mas uvedeny na te strance objekt typu Clock? Jsi to nejak spatne zkopiroval, ci co...
Ja myslim, ze tohle by melo fungovat i ve framu, otazka je, co tam jeste mas za JS a jine veci. Krome JS musis zkopirovat dole i ten div id=datum. www.volny.cz/peter.mlich/Pr/efekty/hodinydig.htm <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"> <html><head> <title>digitalni hodiny</title> <style type="text/css"><!-- body {font-size:80%;font-family:Verdana,Arial,Georgia,Sans;margin:0;p adding:0} .hlav {background:#b0eaff;border-bottom:1px solid #80b0cc;color:#0060b0;text-align:center} .hlav sub {display:block} .hlav a {padding:0 2px;color:#00a000} .hlav a:hover {background:#b0e480;text-decoration:none} .telo {padding:6px} --></style> <script type="text/javascript"><!-- function objGet(x) {if (typeof x=='string') with (document){ if (Boolean(getElementById)) x=getElementById(x); else if (Boolean(all)) x=eval('all.'+x); else if (Boolean(layers)) x=layers[x]; else x=null;}return x;} function hodinky() { var h,m,s, t,d,a; var dny=['Nedeľa','Pondelok','Utorok','Streda','Štvrtok','Piatok','Sobota' ]; var ap=['pulnoc','AM','poledne','PM'] t=new Date(); h=t.getHours(); m=t.getMinutes(); s=t.getSeconds(); d=dny[t.getDay()]; //a=(h==0)?0:(h<12)?1:(h==12)?2:3; //a=ap[a]; m=((m<10)?'0':'')+m; s=((s<10)?'0':'')+s; t='Dneska je '+d+' '+h+':'+m+':'+s;//+' '+a objGet("datum").innerHTML=t; } // --- hodiny --- var timerID = null; var tspeed = 980; function hodiny() { clearTimeout(timerID) hodinky(); timerID=window.setTimeout("hodiny()",tspeed); } //window.onload = hodiny(); --></script> </head> <body onload="hodiny()"> <div class="hlav"> <sub>2005 Petova stranka, Peter Mlich <a href="http://www.volny.cz/peter.mlich/">www.volny.cz/peter.mlich/</a>< /sub> <sub>FREE (HTML CSS JS), Test: Firefox 1.06, Explorer 6.0, Opera 8.0</sub> </div> <div class="telo"> <h3>digitalni hodiny</h3> <div id="datum"></div> </div> </body></html> |
||
peta Profil * |
#8 · Zasláno: 13. 9. 2005, 14:01:49
caesar1987
ten priklad na tom linku jsem jeste upravil, to neukazovalo den a rok. Tech 105, misto 2005 by ses docetl, ze je to spravne. www.jakpsatweb.cz - Javascript - Datum a cas Proste jsi pouzil nespravnou funkci, ktera nevraci fullyaer, ale jen koncovku, jak se pise na PF '99 PF '05 a pod. |
||
Časová prodleva: 16 dní
|
|||
caesar1987 Profil |
#9 · Zasláno: 29. 9. 2005, 22:34:06
no ide to.. dikes....
super praca.... funguje perfektne aj vo framoch..... thx.... si cavo... este raz ...THX... |
||
Časová prodleva: 19 let
|
Toto téma je uzamčeno. Odpověď nelze zaslat.
0