| | |
| Stránka: 1 z 1
| [ Príspevkov: 3 ] | |
Autor | Správa |
---|
Registrovaný: 31.07.07 Prihlásený: 09.01.19 Príspevky: 327 Témy: 85 Bydlisko: Humenné |
Ahojte,
mam naprogramovany v JS kalendár a funguje iba v IE ako by som to mohol spojazdniť aj v Mozille ?? Pre prípad pridavam kód
Kód: <script type="text/javascript"> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin function maxDays(mm, yyyy){ var mDay; if((mm == 3) || (mm == 5) || (mm == 8) || (mm == 10)){ mDay = 30; } else{ mDay = 31 if(mm == 1){ if (yyyy/4 - parseInt(yyyy/4) != 0){ mDay = 28 } else{ mDay = 29 } } } return mDay; } function changeBg(id){ if (eval(id).style.backgroundColor != "yellow"){ eval(id).style.backgroundColor = "yellow" } else{ eval(id).style.backgroundColor = "#ffffff" } } function writeCalendar(){ var now = new Date var dd = now.getDate() var mm = now.getMonth() var dow = now.getDay() var yyyy = now.getFullYear() var arrM = new Array("Január","Február","Marec","Apríl","Máj","Jún","Júl","August","September","Október","November","December") var arrY = new Array() for (ii=0;ii<=4;ii++){ arrY[ii] = yyyy - 2 + ii } var arrD = new Array("Ne","Po","Ut","St","Št","Pi","So")
var text = "" text = "<form name=calForm>" text += "<table border=1>" text += "<tr><td>" text += "<table width=100%><tr>" text += "<td align=left>" text += "<select name=selMonth onChange='changeCal()'>" for (ii=0;ii<=11;ii++){ if (ii==mm){ text += "<option value= " + ii + " Selected>" + arrM[ii] + "</option>" } else{ text += "<option value= " + ii + ">" + arrM[ii] + "</option>" } } text += "</select>" text += "</td>" text += "<td align=right>" text += "<select name=selYear onChange='changeCal()'>" for (ii=0;ii<=4;ii++){ if (ii==2){ text += "<option value= " + arrY[ii] + " Selected>" + arrY[ii] + "</option>" } else{ text += "<option value= " + arrY[ii] + ">" + arrY[ii] + "</option>" } } text += "</select>" text += "</td>" text += "</tr></table>" text += "</td></tr>" text += "<tr><td>" text += "<table border=1>" text += "<tr>" for (ii=0;ii<=6;ii++){ text += "<td align=center><span class=label>" + arrD[ii] + "</span></td>" } text += "</tr>" aa = 0 for (kk=0;kk<=5;kk++){ text += "<tr>" for (ii=0;ii<=6;ii++){ text += "<td align=center><span id=sp" + aa + " onClick='changeBg(this.id)'>1</span></td>" aa += 1 } text += "</tr>" } text += "</table>" text += "</td></tr>" text += "</table>" text += "</form>" document.write(text) changeCal() } function changeCal(){ var now = new Date var dd = now.getDate() var mm = now.getMonth() var dow = now.getDay() var yyyy = now.getFullYear() var currM = parseInt(document.calForm.selMonth.value) var prevM if (currM!=0){ prevM = currM - 1 } else{ prevM = 11 } var currY = parseInt(document.calForm.selYear.value) var mmyyyy = new Date() mmyyyy.setFullYear(currY) mmyyyy.setMonth(currM) mmyyyy.setDate(1) var day1 = mmyyyy.getDay() if (day1 == 0){ day1 = 7 } var arrN = new Array(41) var aa for (ii=0;ii<day1;ii++){ arrN[ii] = maxDays((prevM),currY) - day1 + ii + 1 } aa = 1 for (ii=day1;ii<=day1+maxDays(currM,currY)-1;ii++){ arrN[ii] = aa aa += 1 } aa = 1 for (ii=day1+maxDays(currM,currY);ii<=41;ii++){ arrN[ii] = aa aa += 1 } for (ii=0;ii<=41;ii++){ eval("sp"+ii).style.backgroundColor = "#000000" } var dCount = 0 for (ii=0;ii<=41;ii++){ if (((ii<7)&&(arrN[ii]>20))||((ii>27)&&(arrN[ii]<20))){ eval("sp"+ii).innerHTML = arrN[ii] eval("sp"+ii).className = "c3" } else{ eval("sp"+ii).innerHTML = arrN[ii] if ((dCount==0)||(dCount==6)){ eval("sp"+ii).className = "c2" } else{ eval("sp"+ii).className = "c1" } if ((arrN[ii]==dd)&&(mm==currM)&&(yyyy==currY)){ eval("sp"+ii).style.backgroundColor="#90EE90" } } dCount += 1 if (dCount>6){ dCount=0 } } } // End --> </script>
|
|
Registrovaný: 31.05.09 Prihlásený: 02.06.17 Príspevky: 562 Témy: 37 Bydlisko: BegyBen |
Skus takto : (prikladam ti celu HTML stranku). Ak ti nepojde pozrici mas zapnuty JavaScript v prehliadaci.
Kód: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <HEAD>
<style type="text/css"> <!-- span.label {color:black;width:30;height:16;text-align:center;margin-top:0;background:#ffF;font:bold 13px Arial} span.c1 {cursor:hand;color:black;width:30;height:16;text-align:center;margin-top:0;background:#ffF;font:bold 13px Arial} span.c2 {cursor:hand;color:red;width:30;height:16;text-align:center;margin-top:0;background:#ffF;font:bold 13px Arial} span.c3 {cursor:hand;color:#b0b0b0;width:30;height:16;text-align:center;margin-top:0;background:#ffF;font:bold 12px Arial} --> </style>
<script type="text/javascript"> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin function maxDays(mm, yyyy){ var mDay; if((mm == 3) || (mm == 5) || (mm == 8) || (mm == 10)){ mDay = 30; } else{ mDay = 31 if(mm == 1){ if (yyyy/4 - parseInt(yyyy/4) != 0){ mDay = 28 } else{ mDay = 29 } } } return mDay; } function changeBg(id){ if (eval(id).style.backgroundColor != "yellow"){ eval(id).style.backgroundColor = "yellow" } else{ eval(id).style.backgroundColor = "#ffffff" } } function writeCalendar(){ var now = new Date var dd = now.getDate() var mm = now.getMonth() var dow = now.getDay() var yyyy = now.getFullYear() var arrM = new Array("Január","Február","Marec","Apríl","Máj","Jún","Júl","August","September","Október","November","December") var arrY = new Array() for (ii=0;ii<=4;ii++){ arrY[ii] = yyyy - 2 + ii } var arrD = new Array("Nedeľa","Pondelok","Utorok","Streda","Štvrtok","Piatok","Sobota")
var text = "" text = "<form name=calForm>" text += "<table border=1>" text += "<tr><td>" text += "<table width=100%><tr>" text += "<td align=left>" text += "<select name=selMonth onChange='changeCal()'>" for (ii=0;ii<=11;ii++){ if (ii==mm){ text += "<option value= " + ii + " Selected>" + arrM[ii] + "</option>" } else{ text += "<option value= " + ii + ">" + arrM[ii] + "</option>" } } text += "</select>" text += "</td>" text += "<td align=right>" text += "<select name=selYear onChange='changeCal()'>" for (ii=0;ii<=4;ii++){ if (ii==2){ text += "<option value= " + arrY[ii] + " Selected>" + arrY[ii] + "</option>" } else{ text += "<option value= " + arrY[ii] + ">" + arrY[ii] + "</option>" } } text += "</select>" text += "</td>" text += "</tr></table>" text += "</td></tr>" text += "<tr><td>" text += "<table border=1>" text += "<tr>" for (ii=0;ii<=6;ii++){ text += "<td align=center><span class=label>" + arrD[ii] + "</span></td>" } text += "</tr>" aa = 0 for (kk=0;kk<=5;kk++){ text += "<tr>" for (ii=0;ii<=6;ii++){ text += "<td align=center><span id=sp" + aa + " onClick='changeBg(this.id)'>1</span></td>" aa += 1 } text += "</tr>" } text += "</table>" text += "</td></tr>" text += "</table>" text += "</form>" document.write(text) changeCal() } function changeCal(){ var now = new Date var dd = now.getDate() var mm = now.getMonth() var dow = now.getDay() var yyyy = now.getFullYear() var currM = parseInt(document.calForm.selMonth.value) var prevM if (currM!=0){ prevM = currM - 1 } else{ prevM = 11 } var currY = parseInt(document.calForm.selYear.value) var mmyyyy = new Date() mmyyyy.setFullYear(currY) mmyyyy.setMonth(currM) mmyyyy.setDate(1) var day1 = mmyyyy.getDay() if (day1 == 0){ day1 = 7 } var arrN = new Array(41) var aa for (ii=0;ii<day1;ii++){ arrN[ii] = maxDays((prevM),currY) - day1 + ii + 1 } aa = 1 for (ii=day1;ii<=day1+maxDays(currM,currY)-1;ii++){ arrN[ii] = aa aa += 1 } aa = 1 for (ii=day1+maxDays(currM,currY);ii<=41;ii++){ arrN[ii] = aa aa += 1 } for (ii=0;ii<=41;ii++){ eval("sp"+ii).style.backgroundColor = "#FFFFFF" } var dCount = 0 for (ii=0;ii<=41;ii++){ if (((ii<7)&&(arrN[ii]>20))||((ii>27)&&(arrN[ii]<20))){ eval("sp"+ii).innerHTML = arrN[ii] eval("sp"+ii).className = "c3" } else{ eval("sp"+ii).innerHTML = arrN[ii] if ((dCount==0)||(dCount==6)){ eval("sp"+ii).className = "c2" } else{ eval("sp"+ii).className = "c1" } if ((arrN[ii]==dd)&&(mm==currM)&&(yyyy==currY)){ eval("sp"+ii).style.backgroundColor="#90EE90" } } dCount += 1 if (dCount>6){ dCount=0 } } } // End --> </script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<script type="text/javascript">writeCalendar()</script>
</body> </html> JavaScript si daj do zvast suboru a css si uloz do CSS suboru .Na stranke bude len : Kód: <script type="text/javascript">writeCalendar()</script>
_________________ "Ženy jsou jako domény. Ty nejlepší jsou zabrané, ale pořád můžete získat nějaké z exotických zemí." |
|
Registrovaný: 31.07.07 Prihlásený: 09.01.19 Príspevky: 327 Témy: 85 Bydlisko: Humenné | |
| Stránka: 1 z 1
| [ Príspevkov: 3 ] | |
Podobné témy | Témy | Odpovede | Zobrazenia | Posledný príspevok |
---|
| v kazdom prehliadaci inak v HTML, XHTML, XML, CSS | 2 | 516 | 02.08.2009 17:17 shaggy | | asimiter.com na každom prehliadači v Antivíry a antispywary | 13 | 957 | 21.01.2017 21:58 tairikuokami | | restartovanie PC po každom zapnutí [ Choď na stránku: 1, 2 ] v Operačné systémy Microsoft | 31 | 1434 | 03.03.2010 11:09 Semp | | Vypadávanie internetu na každom PC v Sieťové a internetové programy | 1 | 300 | 03.12.2014 21:29 liqua1 | | Problem BSOD po kazdom starte systemu v Operačné systémy Microsoft | 8 | 1210 | 12.02.2011 23:28 Ondo1 | | 2 zariadenia, na každom iný zvuk v Audio programy | 3 | 387 | 28.08.2015 11:12 M0f0 | | defaultne nastavenie uzivatelia po kazdom prihlaseni v Operačné systémy Microsoft | 9 | 834 | 24.03.2011 8:28 Roj-i | | 2 koncovky na každom konci sieťového kábla? v Siete | 7 | 741 | 01.06.2014 21:39 shiro | | uTorrent v Európe na každom deviatom PC v Novinky | 1 | 434 | 28.04.2008 22:33 fuco | | APM sa resetuje po každom vypnutí disku v Pevné disky a radiče | 28 | 621 | 09.01.2015 22:21 emajko159 | | Windows Installer pri každom spustení sidebaru vo Viste v Operačné systémy Microsoft | 0 | 353 | 17.02.2008 11:54 Gyrxiur | | Desktopové OS sa zjednotia, aplikácie pobežia na každom v Novinky | 6 | 520 | 02.04.2008 14:59 Triminka | | kalendar v HTML, XHTML, XML, CSS | 6 | 753 | 26.11.2008 12:05 walther | | Kalendár v HTML, XHTML, XML, CSS | 1 | 720 | 07.09.2008 18:32 pepek92 | | Kalendar v JavaScript, VBScript, Ajax | 0 | 545 | 23.04.2010 12:48 jtomcik | | Kalendár v HTML, XHTML, XML, CSS | 0 | 602 | 24.02.2009 9:53 mattanyah |
| Nemôžete zakladať nové témy v tomto fóre Nemôžete odpovedať na témy v tomto fóre Nemôžete upravovať svoje príspevky v tomto fóre Nemôžete mazať svoje príspevky v tomto fóre
|
|