javascript函数

来源:互联网 发布:淘宝爆款0销量打造方法 编辑:程序博客网 时间:2024/06/18 18:47
 

getDay()获取一周中的某一天(0---6)

getYear()获取年

getFullYear()完整的四位年

getMonth()获取的是月份(0---11)

getDate()获取月吵的某一天(1---31)




indexOf() 查找子字符串() substr()字符串的截取,

toLowerCase()把字符串转换为小写

random()产生0到1之间的随机小数

Math.round()

产生m--n之间的整数;

math.round(Math.random()*(n-m)+m)



在网页中弹出一个广告:

<!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 language="javascript" type="text/javascript">
function openAdv(){
var w=window.open("http://www.baidu.com","百度","heigth=800,width=1000,location=no,resizable=0,status=0,toolbar=0");

w.moveTo(100,100);

}

</script>

</head>
<body>
<a onclick="openAdv()">淘宝</a>
</body>
</html>

原创粉丝点击