internet:有容乃大 google:find what you want, sorry, not each times baidu:我擅长休闲,动脑筋的事别来烦我哦 -------------------------------- 这个菜单不错,推荐一下http://brainjar.com/dhtml/menubar/demo.html
Js代码瘦身:http://brainjar.com/js/crunch/demo.html
Date.prototype.toString=function(){ //获得yy-mm-dd hh-mm-ss这样的格式 //alert(new Date()); var date = this; var year = date.getFullYear(); var month = date.getMonth()+1; var day = date.getDate(); var hours = date.getHours(); var minutes = date.getMinutes(); var seconds = date.getSeconds(); function _f(n){ if(n<10) n = "0"+n; return n; } return year+"-"+_f(month)+"-"+_f(day)+" "+_f(hours)+":"+_f(minutes)+":"+_f(seconds); }Date.prototype.daysPassed=function(date){ //计算到今天为止经过了多少天 if(!(date instanceof Date)) throw new Error(-1,"错误的参数类型,参数date必须是Date对象的实例。"); var min = 1000*60; var hour = min*60; var day = hour*24; return Math.round(((new Date())-(date))/day);}
Number.prototype.toHex=function(){ var hexStr = "0123456789ABCDEF"; var low = this % 16; var high = (this - low)/16; hex = "" + hexStr.charAt(high) + hexStr.charAt(low); return hex; }String.prototype.endWith=function(str){ if("string"!=typeof(str)) throw new Error(-1,"\""+str+"\" 不是一个字符串。"); return (this.substring(this.length-str.length,this.length)==str); }String.prototype.startWith=function(str){ if("string"!=typeof(str)) throw new Error(-1,"\""+str+"\" 不是一个字符串。"); return (this.substring(0,str.length-1)==str); }都木好意思帖出来...
google:find what you want, sorry, not each times
baidu:我擅长休闲,动脑筋的事别来烦我哦
--------------------------------
这个菜单不错,推荐一下http://brainjar.com/dhtml/menubar/demo.html
//获得yy-mm-dd hh-mm-ss这样的格式
//alert(new Date());
var date = this; var year = date.getFullYear();
var month = date.getMonth()+1;
var day = date.getDate(); var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds(); function _f(n){
if(n<10)
n = "0"+n;
return n;
} return year+"-"+_f(month)+"-"+_f(day)+" "+_f(hours)+":"+_f(minutes)+":"+_f(seconds);
}Date.prototype.daysPassed=function(date){
//计算到今天为止经过了多少天
if(!(date instanceof Date))
throw new Error(-1,"错误的参数类型,参数date必须是Date对象的实例。"); var min = 1000*60;
var hour = min*60;
var day = hour*24; return Math.round(((new Date())-(date))/day);}
Number.prototype.toHex=function(){
var hexStr = "0123456789ABCDEF";
var low = this % 16;
var high = (this - low)/16;
hex = "" + hexStr.charAt(high) + hexStr.charAt(low);
return hex;
}String.prototype.endWith=function(str){
if("string"!=typeof(str))
throw new Error(-1,"\""+str+"\" 不是一个字符串。");
return (this.substring(this.length-str.length,this.length)==str);
}String.prototype.startWith=function(str){
if("string"!=typeof(str))
throw new Error(-1,"\""+str+"\" 不是一个字符串。");
return (this.substring(0,str.length-1)==str);
}都木好意思帖出来...
[email protected]
<script type="text/javascript">
startList.tag = 0;
function startList(rootObj)
{
var navRoot, i=0;
if(rootObj == '' || rootObj == null) rootObj=document.all.navitree; try
{
navRoot = rootObj;
if(navRoot==null)
{
alert('null a wrong accoured');
}
else
{
for (i=0; i<navRoot.childNodes.length; i++)
{
node = navRoot.childNodes[i];
if (node.nodeName=="LI")
{
node.onmouseover=function()
{
this.className ="over";
}
node.onmouseout=function()
{
this.className="out";
}
if(startList.tag==1)
{
node.className = "out";
}
startList(node);
}
else if (node.nodeName=="UL")
{
startList.tag = 1;
startList(node);
}
} //for end
}
} //try end
catch(e)
{
alert(e);
} //catch end
} //startListwindow.onload = startList;
</script><style type="text/css">
@import url( style.css );
body {
font-size: 11px;
font-family: 'Courier New';
}
.navitree a {
display: block;
width: 100%;
padding: 5px;
margin: 1px;
text-decoration: none;
background: #ffe;
color: #000;
}
.navitree a:hover {
background: #880;
color: #fff;
}
.navitree, .navitree ul {
margin: 0px;
padding: 0px;
border-bottom: #ccc 1px solid;
border-right: #ccc 1px solid;
list-style-type: none;
}.navitree {
width: 451px;
}
.navitree li {
position: relative;
width: 150px;
padding: 0px;
border-left: #ccc 1px solid;
border-top: #ccc 1px solid;
float: left;
background: #fff;
}.navitree li ul li {
position: relative;
width: 150px;
padding: 0px;
border: #ccc 1px solid;
border-bottom: 0px;
border-right: 0px;
float: left;
}
.navitree li ul {
display: none;
position: absolute;
left: -1px;
top: 26px;
}.navitree li ul li ul {
position: absolute;
left: 149px; /* Set 1px less than menu width */
top: -1px;
}
li.over ul {
display: block;
visibility: visible;
}
li.out ul {
visibility: hidden;
/* 比用 display:none 效率会高 */
}
</style>
<BODY>
<ul id="navitree" class="navitree">
<li><a href="#">home</a></li>
<li>
<a href="#">about ></a>
<ul id="second">
<li><a href="#">history</a></li>
<li><a href="#">team</a></li>
<li><a href="#">offices</a></li>
</ul>
</li>
<li>
<a href="#">services ></a>
<ul>
<li>
<a href="#">web design ></a>
<ul>
<li><a href="#">web design - sub1</a></li>
<li><a href="#">web design - sub2</a></li>
<li>
<a href="#">web deisgn - sub3 ></a>
<ul>
<li><a href="#">sub3-1</a>
<li><a href="#">sub3-2</a>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</BODY>
{
var o = {
"M+" : this.getMonth()+1, //month
"d+" : this.getDate(), //day
"h+" : this.getHours(), //hour
"m+" : this.getMinutes(), //minute
"s+" : this.getSeconds(), //second
"q+" : Math.floor((this.getMonth()+3)/3), //quarter
"S" : this.getMilliseconds() //millisecond
} //author: meizz
if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
(this.getFullYear()+"").substr(4 - RegExp.$1.length));
for(var k in o)if(new RegExp("("+ k +")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length==1 ? o[k] :
("00"+ o[k]).substr((""+ o[k]).length));
return format;
};
alert(new Date().Format("yyyy-MM-dd"));
alert(new Date().Format("yyyy年MM月dd日"));
alert(new Date().Format("MM/dd/yyyy"));
alert(new Date().Format("yyyy-MM-dd hh:mm:ss S"));
js专栏
<div style="position:absolute;">
<select name="c_cpu" style="position:absolute;top:30px; width: 150px; height: 20px; clip: rect(0 180 110 130) " onChange='c_cpua.value=this.options[this.selectedIndex].value'>
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<input name="c_cpua" type="text" style="position:absolute;top:30px; width: 149px; height: 20px">
</div>
<input type="button" name="Submit" value="提交" onClick="alert(c_cpua.value)">
</body>
</html>
http://www.walterzorn.com
Date.prototype.addTime = function(num,mode){
//code by windy_sk , [email protected]
if(!/[\-]?[\d]+/g.test(num)) return this;
var base =60*60*24*1000;
var result = this.getTime();
switch(mode){
case "y":
result+=base*365*num;
break;
case "m":
result+=base*30*num;
break;
case "w":
result+=base*7*num;
break;
default:
result+=base*num;
}
return(new Date(result));
}
//alert((new Date()).addTime(10,"w"))
//alert((new Date()).addTime(-50,"d"))
//日期差值
Date.prototype.DayDiff = function(cDate,mode){
//code by windy_sk , [email protected]
try{
cDate.getYear();
}catch(e){
return(0);
}
var base =60*60*24*1000;
var result = Math.abs(this - cDate);
switch(mode){
case "y":
result/=base*365;
break;
case "m":
result/=base*365/12;
break;
case "w":
result/=base*7;
break;
default:
result/=base;
break;
}
return(Math.floor(result));
}
//alert((new Date()).DayDiff((new Date(2002,0,1))))
雨中太阳
网页:http://www.SearchAll.cn
搜索:http://www.SearchAll.cn/search/Search.htm
[email protected]
[email protected]