 |
Alarm Clock |
 |
2. July 2007, 12:04
|
#1 (permalink)
|
|
Uye Olmayan
Uye No:
Mesajlar: n/a
Seviye: -INF [ ] Aktiflik: NAN / -INF Güç: -INF / -INF Deneyim: NAN%
|
Alarm Clock
Description: This is a "24 hour cycle" JavaScript alarm clock that performs a custom action (by going to any page on the web) when the desired target time has been reached. For example, you can have the script go to YouTube and play a music video as your custom "waker upper." A flexible JavaScript timer and alarm script!
Example:
Current Time:
11:05:00
Set Alarm:
Hour Minutes Seconds
Set Alarm Action:
*Location of page to launch
Directions
Step 1: Insert the below into the <HEAD> section of your page:
HTML-Kodu:
<style type="text/css">
#jsalarmclock{
font-family: Tahoma;
font-weight: bold;
font-size: 12px;
}
#jsalarmclock div{
margin-bottom: 0.8em;
}
#jsalarmclock div.leftcolumn{
float: left;
width: 150px;
font-size: 13px;
background-color: lightyellow;
clear: left;
}
#jsalarmclock span{
margin-right: 5px;
}
</style>
<script type="text/javascript">
/***********************************************
* JavaScript Alarm Clock- by JavaScript Kit (www.javascriptkit.com)
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more
***********************************************/
var jsalarm={
padfield:function(f){
return (f<10)? "0"+f : f
},
showcurrenttime:function(){
var dateobj=new Date()
var ct=this.padfield(dateobj.getHours())+":"+this.padfield(dateobj.getMinutes())+":"+this.padfield(dateobj.getSeconds())
this.ctref.innerHTML=ct
this.ctref.setAttribute("title", ct)
if (typeof this.hourwake!="undefined"){ //if alarm is set
if (this.ctref.title==(this.hourwake+":"+this.minutewake+":"+this.secondwake)){
clearInterval(jsalarm.timer)
window.location=document.getElementById("musicloc").value
}
}
},
init:function(){
var dateobj=new Date()
this.ctref=document.getElementById("jsalarm_ct")
this.submitref=document.getElementById("submitbutton")
this.submitref.onclick=function(){
jsalarm.setalarm()
this.value="Alarm Set"
this.disabled=true
return false
}
this.resetref=document.getElementById("resetbutton")
this.resetref.onclick=function(){
jsalarm.submitref.disabled=false
jsalarm.hourwake=undefined
jsalarm.hourselect.disabled=false
jsalarm.minuteselect.disabled=false
jsalarm.secondselect.disabled=false
return false
}
var selections=document.getElementsByTagName("select")
this.hourselect=selections[0]
this.minuteselect=selections[1]
this.secondselect=selections[2]
for (var i=0; i<60; i++){
if (i<24) //If still within range of hours field: 0-23
this.hourselect[i]=new Option(this.padfield(i), this.padfield(i), false, dateobj.getHours()==i)
this.minuteselect[i]=new Option(this.padfield(i), this.padfield(i), false, dateobj.getMinutes()==i)
this.secondselect[i]=new Option(this.padfield(i), this.padfield(i), false, dateobj.getSeconds()==i)
}
jsalarm.showcurrenttime()
jsalarm.timer=setInterval(function(){jsalarm.showcurrenttime()}, 1000)
},
setalarm:function(){
this.hourwake=this.hourselect.options[this.hourselect.selectedIndex].value
this.minutewake=this.minuteselect.options[this.minuteselect.selectedIndex].value
this.secondwake=this.secondselect.options[this.secondselect.selectedIndex].value
this.hourselect.disabled=true
this.minuteselect.disabled=true
this.secondselect.disabled=true
}
}
</script>
Step 2: Insert the below into the <BODY> section of your page:
HTML-Kodu:
<form action="" method="">
<div id="jsalarmclock">
<div><div class="leftcolumn">Current Time:</div> <span id="jsalarm_ct" style="letter-spacing: 2px"></span></div>
<div><div class="leftcolumn">Set Alarm:</div> <span><select></select> Hour</span> <span><select></select> Minutes</span> <span><select></select> Seconds</span></div>
<div><div class="leftcolumn">Set Alarm Action:</div> <input type="text" id="musicloc" size="55" value="http://www.youtube.com/watch?v=v1zY_tV5k**" /> <span style="font: normal 11px Tahoma">*Location of page to launch</span></div>
<input type="submit" value="Set Alarm!" id="submitbutton" /> <input type="reset" value="reset" id="resetbutton" />
</div>
</form>
<script type="text/javascript">
jsalarm.init()
</script>
|
|
|
|
 |
| Seçenekler |
|
|
| Stil |
Konuyu değerlendir |
Normal
|
|
Yetkileriniz
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML-KodlarıKapalı
|
|
|
|
Bütün Zaman Ayarları WEZ +3 olarak düzenlenmiştir. Şu Anki Saat: 05:27 . |
|
|
|
173, 171, 172, 170, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 249, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 259, 52, 53, 54, 56, 57, 58, 248, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 150, 151, 152, 153, 154, 155, 156, 157, 158, 237, 168, 183, 179, 160, 175, 178, 167, 162, 163, 164, 165, 166, 1, 176, 177, 180, 181, 182, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 201, 200, 199, 202, 203, 204, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 222, 219, 220, 221, 229, 230, 231, 232, 233, 234, 235, 236, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 250, 251, 252, 253, 254, 255, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 276, 277, 278,
|
|