找出10 - 99 中的10个不同的随机奇偶数
<!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>
</head>
<body>
<script type="text/javascript">
var a = new Array();
for(var i = 1;i <= 10;i++){
x = 2 * parseInt(5 + 45 * Math.random()) + 1;
while(a.indexOf(x) > 0)
x = 2 * parseInt(5 + 45 * Math.random()) + 1;
a.push(x);
}
document.write(a + "<br>");
</script>
</body>
</html
Document对象
Document对象是指在浏览器窗口显示的HTML文档。Document对象作为Window对象包含下的一个对象, 可以利用"window.document" 访问文档的属性和方法。 如果当前窗体中包含框架对象, 可以使用表达式“window.frames(n).document” 来访问框架对象中显示的Document对象, 式中的“n”表示框架对象在当前窗口的索引号。
Cookie属性
Cookie是一段信息字符串, 由浏览器保存在客户端的cookie文件中, 包含了客户机的状态信息。 这些信息服务器都可以访问。
该属性是一个可读可写的字符串吗可使用该属性对当前文档的cookie进行读取, 创建, 修改和删除。
document.cookie = sCookie.
write与writeln的区别(无区别)
<!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>
</head>
<body>
<script language="javascript">
document.writeln("Hello word<br>");
document.writeln("好好学习<br>");
document.writeln("天天向上<br>");
</script>
</body>
</html>
返回指定名称的对象集合
<!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>
</head>
<body>
<input type = "text" name = "text" value = "a" /><br/>
<input type = "text" name = "text" value = "b" /><br/>
<input type = "text" name = "text" value = "c" /><br/>
<input type = "text" name = "text" value = "d" /><br/>
<script language="javascript">
var text = document.getElementsByName('text');
document.write(text.length + "<br>");
for(var i = 0;i < text.length;i++)
document.write(text[i].value);
</script>
</body>
</html>
Location对象
# History