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>
document.all.item作用的更多相关文章
- (predicted == labels).sum().item()作用
⚠️(predicted == labels).sum().item()作用,举个小例子介绍: # -*- coding: utf-8 -*-import torch import numpy as ...
- 详解jquery插件中(function ( $, window, document, undefined )的作用。
1.(function(window,undefined){})(window); Q:(function(window,undefined){})(window);中为什么要将window和unde ...
- 详解jquery插件中;(function ( $, window, document, undefined )的作用
在jquery插件中我们经常看到以下这段代码 1 2 3 ;(function ( $, window, document, undefined ){ //函数体内具体代码 })(jQuery, wi ...
- jquery插件中(function ( $, window, document, undefined )的作用
在jquery插件中我们经常看到以下这段代码 ;(function ( $, window, document, undefined ){ //函数体内具体代码 })(jQuery, window,d ...
- JS的Document属性和方法小结
Document想必大家并不陌生吧,在使用js的过程中会经常遇到它,那么它有哪些属性.哪些方法,在本文将以示例为大家详细介绍下,希望对大家有所帮助 document.title //设置文档标题等价于 ...
- document.readyState等属性,判断页面是否加载完
如何在页面加载完成后再去做某事?什么方法可以判断当前页面加载已完成?document.readyState 判断页面是否加载完成?javascript提供了document.readyState==& ...
- jQuery $(document).ready() 与window.onload的区别
ps:jQuery中$(document).ready()的作用类似于传统JavaScript中的window.onload方法,虽然具有类似的效果,但是它们在触发操作的时间上存在着微妙的差异. 在j ...
- jquery $(document).ready() 与window.onload的异同
Jquery中$(document).ready()的作用类似于传统JavaScript中的window.onload方法,不过与window.onload方法还是有区别的. 1.执行时间 ...
- 转载 jquery $(document).ready() 与window.onload的区别
Jquery中$(document).ready()的作用类似于传统JavaScript中的window.onload方法,不过与window.onload方法还是有区别的. 1.执行时间 windo ...
随机推荐
- stm32之开发入门
一.开发环境配置 在开发stm32应用之前,我们需要先配置好开发环境. 首先从keil官网下载keil MDK-ARM软件包(v5版本与v4版本不同,v5版本需要下载额外的stm32芯片包)和芯片包( ...
- TripAdvisor architecture 2011/06
http://highscalability.com/blog/2011/6/27/tripadvisor-architecture-40m-visitors-200m-dynamic-page-vi ...
- linux下安装Drcom
环境:台式机物理机,centos7 因为要下载依赖包,物理机一开始没有网络,所以我先使用的是实验室的公用ip,然后完成以下操作(网上有大神说,可以现在其他机器上下载依赖包,copy过来也可以,但我没有 ...
- 怎么将vim的剪切版设置成系统的剪切版
如果你用vim敲完了代码,怎么把代码提交到ACMoj的粘贴版上呢. 这是个问题. 去网上查了一下,首先有人说可以在vimrc里面添加 set clipboard=unnamed 我试了一下,没有效果. ...
- js选中select
function selected(id, val) { $('#' + id + ' option[value="' + val + '"]').attr('selected', ...
- 在element-ui的表格组件中为表头添加Tooltip 文字提示
在使用表格组件的时候经常遇到的问题,列数很多,而表头的文字描述长度很长 <el-table-column v-if="!column.event" v-for="( ...
- [poj] Catch That Cow--bfs
Description Farmer John has been informed of the location of a fugitive cow and wants to catch her i ...
- 使用tomcat作为容器安装Jenkins
安装前准备环境:jdk,maven,tomcat jdk 参考centos安装jdk:https://www.cnblogs.com/pipiyan/p/10491876.html maven 已有安 ...
- js 实现发布订阅模式
/* Pubsub */ function Pubsub(){ //存放事件和对应的处理方法 this.handles = {}; } Pubsub.prototype = { //传入事件类型typ ...
- js函数—隐形参数this
前言 this是函数中的隐形参数,它绑定的值取决于函数的调用位置. this的定义 <你不知道的js>中是这样说的:是函数体内的隐式参数,this就是记录函数调用上下文的一个属性.可以在函 ...