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

📄 6.htm

📁 javascript book
💻 HTM
📖 第 1 页 / 共 4 页
字号:
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;head&gt;</font></span></p> 
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;/head&gt;</font></span></p> 
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;body&gt;</font></span></p> 
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;form &gt;</font></span></p>  
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;input type=text   
      onChange=&quot;document.my.elements[0].value=this.value;&quot; &gt;</font></span></p>  
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;/form&gt;</font></span></p> 
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;form   
      NAME=&quot;my&quot;&gt;</font></span></p>  
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;input type=text   
      onChange=&quot;document.forms[0].elements[0].value=this.value;&quot;&gt;</font></span></p>  
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;/form&gt;</font></span></p> 
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;/body&gt;</font></span></p> 
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;/html&gt;</font></span></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">其中用了</font></span><font size="3"><span lang="EN-US">OnChnge</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件</span><span lang="EN-US">(</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当窗体内容改变时激发</span><span lang="EN-US">)</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。第一个使用窗体名字标识</span><span lang="EN-US">my,</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第二个使用窗体数组</span><span lang="EN-US">Forms[]</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。其效果是一致。</span></font></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3"> </font></span></p> 
      <p style="line-height: 150%"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">2、文档对象中的</span><span lang="EN-US">attribute</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性</span></font></p> 
      <p style="line-height: 150%"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">  </span><span lang="EN-US">document</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象中的</span><span lang="EN-US">attribute</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性,主要用于在引用</span><span lang="EN-US">Href</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标识时,控制着有关颜色的格式和有关文档标题、文档原文件的</span><span lang="EN-US">URL</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">以及文档最后更新的日期。这部分元素的主要含义如下:</span></font></p> 
      <p style="line-height: 150%"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(1)链接颜色:</span><span lang="EN-US">alinkcolor</span></font></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">这个元素主要用于,当选取一个链接时,链接对象本身的颜色就按</font></span><font size="3"><span lang="EN-US">alinkcolo   
      r</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指定改变。</span></font></p>  
      <p style="line-height: 150%"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(2)链接颜色:</span><span lang="EN-US">linkcolor</span></font></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">当用户使用</font></span><font size="3"><span lang="EN-US">&lt;A   
      Href=...&gt; Text string &lt;/A&gt;</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">链接后,</span><span lang="EN-US">Textstring</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的颜色就会按</span><span lang="EN-US">Linkcolor</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所指定的颜色更新。</span></font></p>  
      <p style="line-height: 150%"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(3)浏览过后的颜色:</span><span lang="EN-US">VlinkColor</span></font></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">该属性表示的是已被浏览存储为已浏览过的链接颜色。</font></span></p> 
      <p style="line-height: 150%"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(4)背景颜色:</span><span lang="EN-US">bgcolor</span></font></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">该元素包含文档背景的颜色。</font></span></p> 
      <p style="line-height: 150%"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(5)前景颜色:</span><span lang="EN-US">Fgcolor</span></font></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">该元素包含</font></span><font size="3"><span lang="EN-US">HTML</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文档中文本的前景颜色。</span></font></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3"> </font></span></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">3、文档对象的基本元素</font></span></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">(1)窗体属性:</font></span></p> 
      <p style="line-height: 150%"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">  窗体属性是与</span><span lang="EN-US">HTML</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文档中</span><span lang="EN-US">&lt;Form&gt;...&lt;/Form&gt;</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">相对应的一组对象在</span><span lang="EN-US">HTML</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文档所创建的窗体数,由</span><span lang="EN-US">length</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指定。通过</span><span lang="EN-US">document.forms.length</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">反映该文档中所创建的窗体数目。</span></font></p> 
      <p style="line-height: 150%"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(2)锚属性:</span><span lang="EN-US">anchors</span></font></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">  该属性中,包含了</font></span><font size="3"><span lang="EN-US">HTML</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文档的所有</span><span lang="EN-US">&lt;A&gt;   
      &lt;/A&gt;</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标记为</span><span lang="EN-US">Name=...</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的语句标识。所有</span><span lang="EN-US">“</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">锚</span><span lang="EN-US">”</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的数目保存在</span><span lang="EN-US">document.anchors.length</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中。</span></font></p>  
      <p style="line-height: 150%"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(3)链接属性:</span><span lang="EN-US">links</span></font></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">  链接属性是指在文档中</font></span><font size="3"><span lang="EN-US">&lt;A&gt;...&lt;/A&gt;</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的由</span><span lang="EN-US">Href=...</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指定的数目,其链接数目保存在</span><span lang="EN-US">document.links.length</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中。</span></font></p>
      <p style="line-height: 150%"><b><span style="font-family: 黑体"><font size="3">三、范例</font></span></b></p>
      <p style="line-height: 150%"><font size="3"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">例</span><span lang="EN-US">1:</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下面我们通过一个例子来说明文档对象的综合应用。输出结果见图</span><span lang="EN-US">6-2</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所示。</span></font></p>
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">Test6_2.htm</font></span></p>
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;html&gt;</font></span></p>
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;head&gt;</font></span></p>
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;/HEAD&gt;</font></span></p>
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;BOdy&gt;</font></span></p>
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;Form  
      Name=&quot;mytable&quot;&gt;</font></span></p> 
      <p style="line-height: 150%"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">请输入数据:</font></span></p>
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;Input   
      Type=&quot;text&quot; Name=&quot;text1&quot; Value=&quot;&quot;&gt;</font></span></p>  
      <p style="line-height: 150%"><span lang="EN-US"><font size="3">&lt;/Form&gt;</font></span></p> 
      <p style="line-height: 150%"><font size="3"><span lang="EN-US">&lt;A  
      name=&quot;Link1&quot; href=&quot;test31.htm&quot;&gt;</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">链接到第一个文本</span><span lang="EN-US">&lt;/a&gt;&lt;br&gt;</span></font></p> 
      <p style="line-height: 150%"><font size="3"><span lang="EN-US">&lt;A  
      name=&quot;Link2&quot; href=&quot;test32.htm&quot;&gt;</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">链接到第二个文本</span><span lang="EN-US">&lt;/a&gt;&lt;br&gt;</span></font></p> 
      <p style="line-height: 150%"><font size="3"><span lang="EN-US">&lt;A  
      name=&quot;Link2&quot; href=&quot;test33.htm&quot;&gt;</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">链接到第三个文本</span><span lang="EN-US">&lt;/a&gt;&lt;br&gt;</span></font></p> 

⌨️ 快捷键说明

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