4-4.html

来自「Ajax的例子」· HTML 代码 · 共 24 行

HTML
24
字号
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>访问form对象</title>
</head>
<body>
  <form name="firstForm">
    文本框:<input type="text" name="textfield" value="华山论剑">
  </form>
  <br>
<form name="secondForm">
  <input type="button" name="smile" value="哈哈哈">
</form>
<script language="javascript">
document.write("<b>第一个表单的名称为:</b>"+document.firstForm.name+"<br>")
document.write("<b>文本框中的内容是:</b>"+document.firstForm.textfield.value+"<br>");

document.write("<b>第二个表单的名称为:</b>"+document.secondForm.name+"<br>")
document.write("<b>按钮的name属性是:</b>"+document.secondForm.elements[0].name+"<br>");
document.write("<b>按钮的value属性是:</b>"+document.secondForm.elements[0].value);
</script>
</body>
</html>

⌨️ 快捷键说明

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