<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <script>
document.write("Hello World!");
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <script>
document.write("<h1>Hello World!</h1>");
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <a name="html">HTML 教程</a><br>
<a name="css">CSS 教程</a><br>
<a name="xml">XML 教程</a><br>
<a href="/js/">JavaScript 教程</a> <p>锚的数量:
<script>
document.write(document.anchors.length);
</script></p> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <a name="html">HTML 教程</a><br>
<a name="css">CSS 教程</a><br>
<a name="xml">XML 教程</a> <p>文档中第一个锚:
<script>
document.write(document.anchors[0].innerHTML);
</script>
</p> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <form name="Form1"></form>
<form name="Form2"></form>
<form></form>
<p>表单数目:
<script>
document.write(document.forms.length);
</script></p> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <form name="Form1"></form>
<form name="Form2"></form>
<form></form>
<p>第一个表单名称:
<script>
document.write(document.forms[0].name);
</script></p> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <img border="0" src="klematis.jpg" width="150" height="113">
<img border="0" src="klematis2.jpg" width="152" height="128">
<p>图像数目:
<script>
document.write(document.images.length);
</script></p> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <img id="runoob1" border="0" src="klematis.jpg" width="150" height="113">
<img id="runoob2" border="0" src="klematis2.jpg" width="152" height="128">
<p>第一个图像的ID:
<script>
document.write(document.images[0].id);
</script></p> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <img src ="planets.gif" width="145" height="126" alt="Planets" usemap ="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
<area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
<area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
</map>
<p><a href="/js/">JavaScript 教程</a></p>
<p>链接/地址数目:
<script>
document.write(document.links.length);
</script></p> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <img src ="planets.gif" width="145" height="126" alt="Planets" usemap ="#planetmap">
<map name="planetmap">
<area id="sun" shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
<area id="mercury" shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
<area id="venus" shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
</map>
<p><a id="javascript" href="/js/">JavaScript 教程</a></p>
<p>第一个链接/地址的ID:
<script>
document.write(document.links[0].id);
</script></p> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> 与此文档相关的Cookies:
<script>
document.write(document.cookie);
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> 加载这个文件的域名:
<script>
document.write(document.domain);
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> 文档最后修改:
<script>
document.write(document.lastModified);
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> 本文档的引用地址:
<script>
document.write(document.referrer);
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> 文档的标题为:
<script>
document.write(document.title);
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> 文档的完整的URL:
<script>
document.write(document.URL);
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script>
function createDoc(){
var doc=document.open("text/html","replace");
var txt="<!DOCTYPE html><html><body>学习 HTML DOM 很有趣!</body></html>";
doc.write(txt);
doc.close();
}
</script>
</head> <body>
<input type="button" value="新文档" onclick="createDoc()">
</body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <p>注意write()方法不会在每个语句后面新增一行:</p>
<pre>
<script>
document.write("Hello World!");
document.write("Have a nice day!");
</script>
</pre>
<p>注意writeln()方法在每个语句后面新增一行:</p>
<pre>
<script>
document.writeln("Hello World!");
document.writeln("Have a nice day!");
</script>
</pre> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<head>
<script>
function getValue(){
  var x=document.getElementById("myHeader");
  alert(x.innerHTML);
}
</script>
</head>
<body> <h1 id="myHeader" onclick="getValue()">点击我!</h1> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script>
function getElements(){
var x=document.getElementsByName("x");
alert(x.length);
}
</script>
</head>
<body> 猫:
<input name="x" type="radio" value="猫">
狗:
<input name="x" type="radio" value="狗">
<input type="button" onclick="getElements()" value="多少名称为 'x'的元素?"> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script>
function getElements(){
  var x=document.getElementsByTagName("input");
  alert(x.length);
}
</script>
</head>
<body> <input type="text" size="20"><br>
<input type="text" size="20"><br>
<input type="text" size="20"><br><br>
<input type="button" onclick="getElements()" value="多少input元素?"> </body>
</html>

吴裕雄--天生自然 JAVASCRIPT开发学习:对象 实例(2)的更多相关文章

  1. 吴裕雄--天生自然 JAVASCRIPT开发学习:对象

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  2. 吴裕雄--天生自然 JAVASCRIPT开发学习:prototype(原型对象)

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  3. 吴裕雄--天生自然 JAVASCRIPT开发学习:JavaScript 对象 实例

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  4. 吴裕雄--天生自然 JAVASCRIPT开发学习:Date(日期) 对象

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  5. 吴裕雄--天生自然 JAVASCRIPT开发学习:RegExp 对象

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  6. 吴裕雄--天生自然 JAVASCRIPT开发学习:Math(算数) 对象

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  7. 吴裕雄--天生自然 JAVASCRIPT开发学习:Array(数组) 对象

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  8. 吴裕雄--天生自然 JAVASCRIPT开发学习:(String) 对象

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  9. 吴裕雄--天生自然 JAVASCRIPT开发学习:Number 对象

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

随机推荐

  1. Cookie API和记录上次来访时间

    1.什么是Cookie? Cookie是一种会话技术,用千将会话过程中的数据保存到用户的浏览器中,从而使浏览器和服务器可以更好地进行数据交互. 在现实生活中,当顾客在购物时,商城经常会赠送顾客一张会员 ...

  2. 十一、GUI设计-记事本程序

    """记事本程序""" from tkinter import *from tkinter.filedialog import *from ...

  3. python画图嵌入html

    #-*- coding=utf-8 -*- import matplotlib import matplotlib.pyplot as plt from io import BytesIO impor ...

  4. java将HSSFWorkbook生成的excel压缩到zip中

    思路:1.写入输入流中. 2.将输入流加到ZipOutputStream压缩流中 List<DocumentModel> list = null; try { list = documen ...

  5. JXCPC 试题册

    JXCPC 试题册 Input file: standard input Output file: standard output Time limit: 1s Memory limit: 256 m ...

  6. OpenMP笔记(四)

    个人博客地址:http://www.bearoom.xyz/2019/02/22/openmp4/ 一.private private子句用于将一个或多个变量声明成线程私有的变量,这样每个线程都有该变 ...

  7. 洛谷P4071-[SDOI2016]排列计数 题解

    SDOI2016-排列计数 发现很多题解都没有讲清楚这道题为什么要用逆元.递推公式怎么来的. 我,风雨兼程三十载,只为写出一篇好题解. 还是我来造福大家一下吧. 题目大意: 一个长度为 n 且 1~n ...

  8. python import xx和from xx import x 中的坑

    先回顾一下理解程度 什么是不可变类型和可变类型? 可变类型是,修改变量后 引用的内存地址不变,引用的内存中的内容发生变化(是针对变量名的引用来理解). # 在a.py中定义了一个test属性 test ...

  9. python中的倒序遍历

    1.在列表本身倒序 a = [1, 3, 7, 5, 2, 6] a.reverse() # 在列表本身进行倒序,不返回新的值 print(a) # 输出a: # [6, 2, 5, 7, 3, 1] ...

  10. windows下CreateDirectory创建路径失败的解决办法

    第一: 权限不够: SECURITY_ATTRIBUTES sa;SECURITY_DESCRIPTOR sd; InitializeSecurityDescriptor(&sd,SECURI ...