11-7.htm

来自「javascript 的原代码,是一本书的代码」· HTM 代码 · 共 37 行

HTM
37
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
   <form name="myForm1" method="post" action="index.html">
      请输入一些文字:<input type="text" value="中了" name="txtener">
   </form><br>
   <form name="myForm2" method="post">
       <input type="button" name="b1" value="红色">
	   <input type="button" name="b2" value="兰色">
	   <input type="button" name="b3" value="绿色">
   </form>
   
   <script language="javascript">
       document.writeln("<pre>");
	   document.writeln("表单一的名称: "+document.writeln(document.forms[1].name));
	   document.writeln(document.forms[0].name);
	   document.writeln(document.forms[0].length);
	   document.writeln(document.forms[1].length);
	   document.writeln(document.myForm2.b1.value);
	   document.writeln(document.myForm2.b2.value);
	   
	   for(var i = 0;i<document.myForm2.length;i++){
	       document.writeln(document.forms[1].elements[i].name);
		   document.writeln(document.forms[1].elements[i].value);
		   document.writeln(document.forms[1].elements[i].type);
	   }
	   document.writeln("</pre>");
   </script>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?