<style type="text/css"> <!-- .STYLE1 {color: #FF0000} .STYLE2 {color: #FF00FF} .STYLE3 {color: #333333} .STYLE4 {color: #FF9966} .STYLE6 {color: #FF0000; font-size: 18px; } --> </style> </head> <body> <table width="970" border="0" cellspacing="0" cellpadding="0"> <tr> <th scope="col"><link href="http://hao.360.cn/css/css_opt.css" rel="stylesheet" type="text/css" /> <style> #clockT{ width:320px; font-size:12px; line-height:180%; margin:0 auto; background:url(http://img.qihoo.com/images/2008/hao360/1028/bgcon.gif) center top no-repeat; margin-top:10px} #clockT .close{ width:100%; padding:6px 0 12px;} #clockT .close img{ float:right; margin-right:6px; display:inline;} #clockT .conBox{ width:100%; background:url(http://img.qihoo.com/images/2008/hao360/1028/bgcon.gif) center bottom no-repeat; margin-bottom:-10px; _margin-bottom:0px; clear:both;} #clockT .cloBox{ width:308px; margin:0 auto;} #clockT .point{ width:278px; color:#0E6DBC; padding-bottom:10px; margin:6px auto 0;} #clockT .todays{ background:#fff; padding:6px 0 3px; text-align:center; font-size:14px; border:1px solid #B4D6F4; } #clockT .todays a{ font-size:14px;} #clockT .tools{ background:#fff; border:1px solid #AFD2F0; padding:6px 18px;} #clockT .tools td{ vertical-align:top; padding:5px 0;} #clockT .tools td *{ vertical-align:text-bottom;} #clockT .tools textarea{ width:178px; height:60px; padding:6px;} #clockT .tagBox{ position:relative; width:100%; margin-top:5px; margin-bottom:-1px; clear:both;} #clockT .tagBox li{ width:88px; height:22px; margin-right:3px; display:inline; text-align:center; padding-top:4px; line-height:22px; background:url(http://img.qihoo.com/images/2008/hao360/1028//tagimg.gif) left top no-repeat; float:left;} #clockT .tagBox li.at{ background-position:right top;} #clockT .listC{ width:100%; clear:both;} #clockT .listC li{ background:#FFFCE6; padding:0 5px; margin-bottom:3px; border:1px solid #F7EEB1;} #clockT .listC li img{ float:right; margin-top:6px; margin-right:5px;} #clockT .listC li a{ color:#004DCC;} #clockT .time{ text-align:center; width:100%; background:url(http://img.qihoo.com/images/2008/hao360/1028/bg_orange.gif) center no-repeat; line-height:57px; color:#338500; font-size:36px; font-family:Arial, Helvetica, sans-serif; } #clockT .btnA{ width:100%; clear:both;} #clockT .btnA li{ width:81px; cursor:pointer; font-size:14px; color:#3366BB; font-weight:bold; margin:0 2px; display:inline; height:35px; text-align:center; line-height:35px; background:url(http://img.qihoo.com/images/2008/hao360/1028/btn09.gif) -100px 0 no-repeat; float:left;} #clockT .btnA li.out{ background-position:-100px -35px; color:#9CB7E1;} #clockT .btnA li.at{background:url(http://img.qihoo.com/images/2008/hao360/1028/btn09.gif) -100px 0 no-repeat;} #clockT .btnA li.out1{ width:95px; background:url(http://img.qihoo.com/images/2008/hao360/1028/btn09.gif) 0 -35px no-repeat; color:#9CB7E1;} #clockT .btnA li.at1{ width:95px; background:url(http://img.qihoo.com/images/2008/hao360/1028/btn09.gif) 0 0 no-repeat;} #clockT .tagBox:after,#clockT .close:after,#clockT .tools:after{ display:block; clear:both; height:0; content:""; visibility:hidden;} </style> </head> <body> <div id="clockT"> <div class="close">&nbsp;</div> <div class="conBox"> <div class="cloBox"> <div class="todays">当前时间：<a href="#">2009</a>年<a href="#">09</a>月<a href="#">14</a>日 18时41分15秒</div> <ul class="tagBox"><li class="at">定时闹钟</li></ul> <div class="tools"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="28%"><a href="http://www.80018.org/" class="STYLE1">提醒时间</a>：</td> <td width="72%"> <label> <select name="select"> <option>23</option> </select> </label>时 <label> <select name="select2"> <option>45</option> </select> </label>分 </td> </tr> <tr> <td><a href="http://www.80018.org/" class="STYLE2">闹钟铃声</a>：</td> <td><label> <select name="select3"><option value='http://hao.360.cn/img/131/mid/1.mid'>爱如潮水</option><option value='http://hao.360.cn/img/131/mid/2.mid'>春江花月夜</option><option value='http://hao.360.cn/img/131/mid/3.mid'>二泉映月</option><option value='http://hao.360.cn/img/131/mid/4.mid'>回家</option><option value='http://hao.360.cn/img/131/mid/5.mid'>卡农</option><option value='http://hao.360.cn/img/131/mid/6.mid'>梁祝</option><option value='http://hao.360.cn/img/131/mid/7.mid'>浏阳河</option><option value='http://hao.360.cn/img/131/mid/8.mid'>茉莉花</option><option value='http://hao.360.cn/img/131/mid/9.mid'>南泥湾</option><option value='http://hao.360.cn/img/131/mid/10.mid'>起床号</option><option value='http://hao.360.cn/img/131/mid/11.mid'>千里之外</option><option value='http://hao.360.cn/img/131/mid/12.mid'>上海滩</option><option value='http://hao.360.cn/img/131/mid/13.mid'>水边的阿迪丽娜</option><option value='http://hao.360.cn/img/131/mid/14.mid'>天仙配</option><option value='http://hao.360.cn/img/131/mid/15.mid'>甜蜜蜜</option><option value='http://hao.360.cn/img/131/mid/16.mid'>土耳其进行曲</option><option value='http://hao.360.cn/img/131/mid/17.mid'>我只在乎你</option><option value='http://hao.360.cn/img/131/mid/18.mid'>星语心愿</option><option value='http://hao.360.cn/img/131/mid/19.mid'>致爱丽丝</option><option value='http://hao.360.cn/img/131/mid/20.mid'>猪八戒背媳妇</option><option value='http://hao.360.cn/img/131/mid/21.mid'>最浪漫的事</option></select> <button id='alarm_music_button'>试听</button></label></td> <BGSOUND id='alarm_player' autostart=true loop=1> </tr> <tr> <td><a href="http://www.80018.org/" class="STYLE3">提示文字</a>：</td> <td> <input name="alarm_textarea" maxlength=40 value="休息，休息一下吧！"> </td> </tr> <tr> <td><a href="http://www.80018.org/" class="STYLE4">重复提醒</a>：</td> <td> <label for="noRepeat"><input type="radio" id="noRepeat" name="alarm_is_single" checked value="1" /> 不重复</label><label for="repeatDaily"> <input type="radio" name="alarm_is_single" id="repeatDaily" value="0" /> 每天提醒</label> </td> </tr> <tr> <td>&nbsp;</td> <td><a href='#confirmed' onclick='qihoo.alarm.confirmed();return false;'><img src="http://img.qihoo.com/images/2008/hao360/1028/btn.gif" width="142" height="41" alt="确定添加闹钟"/></a></td> </tr> </table> <ul class="listC"></ul> </div> <div class="point"> <h1>温馨提示：</h1> <p>·如果关闭这个页面，闹钟功能将失效。</p> <p>·需要打开音响或佩戴耳机，以便听到提示铃声。<span class="STYLE6"><a href="80018org.html" class="STYLE6">闹钟代码</a></span></p> </div> </div> </div> </div> <script type="text/javascript"> function getCookie(name){var arr; var reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");if(arr=document.cookie.match(reg)){return unescape(arr[2]);}else{return null;}} function setCookie(name,value){var expire = arguments[2] ? arguments[2] : 365*24*60*60*1000;var exp = new Date();exp.setTime(exp.getTime() + expire);document.cookie = name + "="+ escape (value) + ";path=/;expires=" + exp.toGMTString();}</script> <script type="text/javascript" src="http://hao.360.cn/css/jquery132.js"></script> <script type="text/javascript"> var qihoo = qihoo || {}; qihoo.alarm = qihoo.alarm || {}; jQuery.extend(qihoo.alarm , { second_handler_timeshow : null,//一秒一次的把手 external_time_handler:null,//一秒一秒地外部把手 unique_id:'xxadboo',//唯一 id Cookie alarm_array: new Array(), init : function(){ //从 Cookie 中得到闹钟信息，之后结构化后赋值 qihoo.alarm.unserialize_from_cookie(); //关闭按钮 $('#clockT').children('.close').children().bind('click' , function(){ qihoo.alarm.close(); return false; }); /* if(qihoo.alarm.alarm_array.length == 0){ $('a[href=#displayClock] b').removeClass('clo'); }else{ $('a[href=#displayClock] b').addClass('clo'); };*/ qihoo.alarm.bind_music();//绑定时间 $('select[name=select3]').bind('change' , function(){ //qihoo.alarm.stop_music(); qihoo.alarm.playing_music(); /* $('#alarm_music_button').text('停止'); $('#alarm_player').attr('src' , ''); $('#alarm_player').attr('src' , $('select[name=select3]').val()); */ return false; }); }, //显示功能 display:function(){ //开始跑一秒一次，显示时间用 try{ clearInterval(qihoo.alarm.second_handler_timeshow); }catch(e){} qihoo.alarm.second_handler_timeshow = setInterval('qihoo.alarm.sht_hook();',1000); qihoo.alarm.sht_hook();//当前时间 qihoo.alarm.set_alarm_time();//设置闹铃时间 qihoo.alarm.bind_event();//绑定事件 $('#clockT').show(); }, bind_event:function(){ //qihoo.alarm.alarm_array.push(kk); $('ul.listC').empty(); /* if(qihoo.alarm.alarm_array.length == 0){ $('a[href=#displayClock] b').removeClass('clo'); return false; }*/ //$('a[href=#displayClock] b').addClass('clo'); $.each(qihoo.alarm.alarm_array , function(k,v){ //时间 歌曲 提示语 是否单次提醒 k++; var hour = new Date(parseInt(v[0])).getHours(); var minute = new Date(parseInt(v[0])).getMinutes(); if(hour < 10) {hour = '0' + hour.toString()} if(minute < 10){minute= '0' + minute.toString()} var is_single = v[3] ? '单次提醒':'重复提醒'; v[2] = decodeURIComponent(v[2]); var content = '<li><a href="#" onclick="qihoo.alarm.cancel_alarm('+(k-1)+');return false;"><img src="http://img.qihoo.com/images/2008/hao360/1028/clo_ico.gif" width="8" height="8" border="0" /></a><strong>'+k+'</strong> '+is_single+'：'+hour+':'+minute+' <a href="#" onclick="return false;" alt="'+qihoo.alarm.htmlspecialchar(v[2])+'">'+qihoo.alarm.htmlspecialchar(v[2].substr(0,9))+'</a></li>'; $('ul.listC').append(content); }); }, cancel_alarm:function(id){ id = parseInt(id); var ee = new Array(); $.each(qihoo.alarm.alarm_array , function(k,v){ if(k != id){ ee.push(v); } }); qihoo.alarm.alarm_array = ee; qihoo.alarm.bind_event();//绑定事件 qihoo.alarm.serialize_to_cookie();//存储 }, htmlspecialchar:function(ee){//山寨 PHP 的 htmlspecialchar 。囧rz ee = $.trim(ee); var zz = document.createElement('div'); zz.appendChild(document.createTextNode(ee)) return zz.innerHTML; }, confirmed:function(){//确认添加 if(qihoo.alarm.alarm_array.length > 7){ alert('最多只能添加 8 个闹钟提醒'); return false; } //得到时间 var time = new Date().getTime(); var hour = parseInt($('select[name=select]').val()); var minute = parseInt($('select[name=select2]').val()); if(hour < new Date().getHours()){//如果小时小于现在时,就是明天 time += 60*60*24*1000; }else if((hour == new Date().getHours()) && (minute <= new Date().getMinutes())){//如果时间等于现在时间，但是分钟小于现在时，就是明天 time += 60*60*24*1000; }else{//否则一概是 } var ee = new Date(time); ee.setHours(hour,minute,0); time = ee.getTime(); //得到歌曲地址 music = $('select[name=select3]').val(); //得到提示内容 var alarm_prompt = $.trim($('input[name=alarm_textarea]').val()); if(alarm_prompt == ''){ alarm_prompt='休息，休息一下！'; return false; } var is_single = 1; //是否重复 $('input[name=alarm_is_single]').each(function(k,v){ if(v.checked){ is_single = parseInt(v.value); } }); qihoo.alarm.alarm_array.push(new Array(time,music,alarm_prompt,is_single ,0));//最后那个 0 用来处理显示临界补偿 qihoo.alarm.bind_event();//绑定事件 qihoo.alarm.serialize_to_cookie();//存储 }, one_second_over_again:function(){//外部的钩子，跟艾丁宝一起干活 function 名都 xx 化了 if(qihoo.alarm.alarm_array.length == 0){ return false; } var write_back = new Array(); $.each(qihoo.alarm.alarm_array , function(k,v){ v[2] = decodeURIComponent(v[2]); if(v[0] <= new Date().getTime()){//如果到时候 if((parseInt(v[0])+5000) > new Date().getTime()){//如果 5 秒钟内就提示，过 5 秒钟就 pass $('#alarm_player').attr('src' , v[1]); alert(v[2]); $('#alarm_player').attr('src' , ''); } v[0] += 60*60*24+1000;//明天这个时候继续 if(v[3]){//如果是单次执行 v = null;//否则永不执行 } } if(v != null) write_back[k] = v; }); if(qihoo.alarm.alarm_array.toString() != write_back.toString()){ qihoo.alarm.alarm_array = write_back; qihoo.alarm.serialize_to_cookie();//存储 qihoo.alarm.bind_event();//绑定事件 } }, external_time_hook_activation:function(){//外部的闹钟 try{ clearInterval(qihoo.alarm.external_time_handler); }catch(e){} qihoo.alarm.external_time_handler = setInterval('qihoo.alarm.one_second_over_again();',1000); }, bind_music:function(){ $('#alarm_music_button').bind('click' , function(){ if($('#alarm_music_button').text() == '试听'){//播放音乐 qihoo.alarm.playing_music(); }else{//停止音乐 qihoo.alarm.stop_music(); } return false; }); }, playing_music:function(){ $('#alarm_player').attr('src', $('select[name=select3]').val()); $('#alarm_music_button').text('停止'); }, stop_music:function(){ $('#alarm_player').attr('src', ''); $('#alarm_music_button').text('试听'); }, //设置提醒时间 set_alarm_time:function(){ var offset = 60*10*1000+(new Date().getTime());//5 分钟之后 var offset_date = new Date(offset); var year = offset_date.getFullYear(); var month = (offset_date.getMonth())+1; var day = offset_date.getDate(); var hour = offset_date.getHours(); var minute = offset_date.getMinutes(); var second = offset_date.getSeconds(); /* if(month < 10) {month = '0' + month.toString()} if(day < 10) {day = '0' + day.toString()} if(hour < 10) {hour = '0' + hour.toString()} if(minute < 10){minute= '0' + minute.toString()} if(second < 10){second= '0' + second.toString()} */ var i =1; var option = ''; var writeOption = ''; $('select[name=select]').empty(); for(i=0;i<24;i++){//小时 writeOption = i; //if(i < 10) {writeOption = '0' + i.toString()} if(i == hour){ option = '<option selected>' + writeOption + '</option>'; }else{ option = '<option>' + writeOption + '</option>'; } $('select[name=select]').append(option); } var i =1; var option = ''; var writeOption = ''; $('select[name=select2]').empty(); for(i=0;i<60;i++){//分钟 writeOption = i; //if(i < 10) {writeOption = '0' + i.toString()} if(i == minute){ option = '<option selected>' + writeOption + '</option>'; }else{ option = '<option>' + writeOption + '</option>'; } $('select[name=select2]').append(option); } }, //时间显示的钩子 sht_hook:function(){ //显示当前时间 var year = new Date().getFullYear(); var month = (new Date().getMonth())+1; var day = new Date().getDate(); var hour = new Date().getHours(); var minute = new Date().getMinutes(); var second = new Date().getSeconds(); if(month < 10) {month = '0' + month.toString()} if(day < 10) {day = '0' + day.toString()} if(hour < 10) {hour = '0' + hour.toString()} if(minute < 10){minute= '0' + minute.toString()} if(second < 10){second= '0' + second.toString()} $('div.todays').html('当前时间：<a href="#" onclick="return false;">'+year+'</a>年<a href="#" onclick="return false;">'+month+'</a>月<a href="#" onclick="return false;">'+day+'</a>日 '+hour+'时'+minute+'分'+second+'秒'); }, //往 Cookie 中写 serialize_to_cookie:function(){ var ee = new Array(); $.each(qihoo.alarm.alarm_array , function(k,v){ v[0] = parseInt(v[0]); v[2] = encodeURIComponent(v[2]); ee[k] = v.join('='); }); ee = ee.join('|'); setCookie(qihoo.alarm.unique_id , ee); return true; //===================================== }, //从 Cookie 中读取，反序列化之后　ＸＸ unserialize_from_cookie:function(){ var ee = getCookie(qihoo.alarm.unique_id); if(ee == null) return false; //用这个替换 //replace(/\r|\n/gi,'[br]') var zz; zz = ee.split('|');//拿出 N 个 alarm if(zz == null) return false;//没有闹钟 $.each(zz,function(k,v){ var kk = new Array(); kk = v.split('='); if(kk.length == 5){ kk[0] = kk[0].toString(); kk[2] = decodeURIComponent(kk[2]); qihoo.alarm.alarm_array.push(kk); } }); }, //关闭 close:function(){ qihoo.alarm.stop_music(); $('#clockT').hide(); //关闭跑的时钟 clearInterval(qihoo.alarm.second_handler_timeshow); qihoo.alarm.serialize_to_cookie();//存储 }, set_default_prompt_from_cookie:function(){ qihoo.alarm.set_prompt(qihoo.alarm.clock_prompt); }, //设置留言 set_prompt:function(msg){ $('input[name=alarm_textarea]').val(msg); }, //得到留言 get_prompt:function(msg){ return $('input[name=alarm_textarea]').val(); } }); //开始邦定 qihoo.alarm.init(); qihoo.alarm.external_time_hook_activation();//一秒一秒跑啊跑 window.onload=function(){qihoo.alarm.display();} </script> </body> </html>&nbsp;</th> </tr> </table> </body> </html>
当前时间：2009年09月14日 18时41分15秒 定时闹钟
提醒时间： | 时 分
闹钟铃声： |
提示文字： |
重复提醒： | 不重复 每天提醒
# 温馨提示： ·如果关闭这个页面，闹钟功能将失效。 ·需要打开音响或佩戴耳机，以便听到提示铃声。闹钟代码 把上面的红色代码复制下来就可以了，闹钟功能就OK了