⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 17.4.htm

📁 这是我卖的书上的源码 这书是电子邮电出版的是有关网络编程 有详细的例子
💻 HTM
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Textfield Test</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<body>
<h2 align="center">测试表单</h2>
<form name="testform" id="testform" 
      action="http://www.javascriptref.com" method="get">
<label>文本域 1: <input type="text" name="text1" id="text1" size="20"
               value="初始值"></label>
<br>
<label>文本域 2: <input type="text" name="text2" id="text2" size="20"
               maxlength="20"></label>
<p>
<input type="button" value="检测值"
       onclick="alert(document.testform.text1.value);">

<input type="button" value="设置值"  
  onclick="document.testform.text1.value=document.testform.text2.value;"
><p>

<input type="button" value="“禁用”触发器"
onclick="document.testform.text1.disabled=!(document.testform.text1.disabled
);">

<input type="button" value="“只读”触发器"
onclick="document.testform.text1.readOnly=!(document.testform.text1.readOnly
);"><p>

<input type="button" value="获得焦点"         
       onclick="document.testform.text1.focus();">
<input type="button" value="失去焦点" 
       onclick="document.testform.text1.blur();"><p>
<input type="button" value="选择 文本域 1" 
       onclick="document.testform.text1.select();">
</form>

<hr>
<h2 align="center">公用域属性</h2>
<script type="text/javascript">
<!-- 
   document.write("defaultValue: " + document.testform.text1.defaultValue+"<br>");
   document.write("form: "+document.testform.text1.form+"<br>");
   document.write("form.name: " + document.testform.text1.form.name+
"<br>");
   document.write("name: "+document.testform.text1.name+"<br>");
   document.write("type: "+document.testform.text1.type+"<br>");
   document.write("value: "+document.testform.text1.value+"<br>");
//-->
</script>
</body>
</html>

⌨️ 快捷键说明

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