设为首页 <a onclick='this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.baidu.com');'>设为首页</a> 加入收藏 <A href="javascript:javascript:window.external.AddFavorite('http://www.baidu.com','软件下载站点');">加入收藏</A> //添加收藏 function addFav() { var url = "http://www.baidu.com"; var favTitle = "百度"; var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("360se") > -1) { alert("360浏览器限制,请按 Ctrl+D 手动收藏!"); } else if (ua.indexOf("msie 8") > -1) { window.external.AddToFavoritesBar(url, title); //IE8 } else if (document.all) { try{ window.external.addFavorite(url, favTitle); } catch(e){ alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!'); } } else if (window.sidebar) { try{ window.sidebar.addPanel(favTitle, url,""); } catch(e){ alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!'); } } else { alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!'); } }
首页上显示时间:
今天是:<scriptsrc="/date.js" type="text/javascript"></script>
// JavaScript Document var isnMonths=new initArray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月") var isnDays=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日"); today=new Date(); function initArray(){ for(i=0;i<initArray.arguments.length;i++) this[i]=initArray.arguments[i]; } function getFullYear(d){ yr = d.getYear(); if(yr<1000) yr += 1900; return yr; } var StrTemp = getFullYear(today) +"年" +"" + isnMonths[today.getMonth()]; StrTemp = StrTemp + "" + today.getDate()+"日 "+ isnDays[today.getDay()]; document.write(StrTemp); //-->
<span>今日天气:</span><spanclass="weather"><iframesrc="http://m.weather.com.cn/m/pn7/weather.htm?id=101110101T" width="280" height="20"marginwidth="0" marginheight="0"hspace="0" vspace="0" frameborder="0"allowtransparency="true" scrolling="no"></iframe></span>
<iframe class="weather" width="280" scrolling="no" height="25" frameborder="0" allowtransparency="true" src="http://i.tianqi.com/index.php?c=code&id=34&icon=1&num=3"></iframe>