151113

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>

<script type="application/javascript">

var b='aadsfd'.length;

alert("长度是"+b);

alert("查找到=" +"asfsfg".lastIndexOf('s'));

alert("截取到=" +"asfsfg".substr(2,2));

alert("查找到=" +"asfsfg".substring(2,4));

alert("替换成=" +"asfsfg".replace('s','e'));

var as="2015-12-12".split("-");

for(i =0;i< as.length;i++)
{
    alert("as="+as[i])
}

<!-- -->var dt = new Date(2016,12,22,12,12,12);
var dt = new Date();
alert(dt.getFullYear()+"-"+dt.getMonth()+"-"+dt.getDate()+" "+dt.getHours()+":"+dt.getMinutes()+":"+dt.getSeconds()+" "+dt.getDay());

</script>
</head>

<body>
<input type="button" value="打开"  onclick="window.open('http://www.baidu.com','百度','width=300,height=400,top=50,left=100,scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes,location=yes');"/>

<input type="button" value="关闭" onclick="window.close();" />
</body>
</html>
原文地址:https://www.cnblogs.com/zhuxiaolin/p/4963468.html