zoukankan      html  css  js  c++  java
  • document.all.item作用

    1、document.all.myCheckBox和 document.all.item通过控件的名字定位控件,item()中是控件的名字
    例如:
    <input type="checkbox" name="myCheckBox">
    可以用
    document.all.myCheckBox得到这个控件,也可以写成document.all.item("myCheckBox")
    用item的好处是,
    1.如果你的控件的name是数字,比如<br>
    <input type="checkbox" name="123456789">
    ,使用document.all.123456789会报错,用document.all.item("123456789")可以正确得到。
    2.如果你的控件名字存在一个变量中,你必须这样写
    var name = "myCheckBox";
    eval("document.all."+name);
    同样也可以写成document.all.item(name)
    <form name="form1">
    <input id="a" name="a" type="text" value="123123213">
    </form>
    <script language="javascript">
    document.write(document.form1.a.value);
    document.write("<br>");
    document.write(document.all.item("a").value);
    </script>


    2、一个form同时提交到两个页面的效果,工作的需要,随手记了下来!
    <script language="javascript">
    function F_submit(){
    document.form1.target="_blank";
    document.form1.action="1.asp";
    document.form1.submit();
    document.form1.target="_blank";
    document.form1.action="2.asp";
    document.form1.submit();
    }
    </script>
    <form name="form1" method="post" action="">
    <input type="text" name="textfield">
    <input type="button" name="Submit" value="提交" onClick="F_submit()">
    </form>

  • 相关阅读:
    C语言基础
    R安装包
    随笔
    计算机组成原理(三)--存储器的层次结构
    计算机组成原理(一)
    查找
    二叉树
    Mesos
    第三章 线性表
    第四章 栈与队列
  • 原文地址:https://www.cnblogs.com/zhangwei99com/p/7266693.html
Copyright © 2011-2022 走看看