环境IE8
<html>
<head>
<title>JS</title>
<script type="text/javascript">
function test(){
alert(document.getElementsByName("fpdm")[0].value)
}
</script>
</head>
<body>
<form name="form1">
<input type="text" name="fpdm">
<input type="text" name="fpdm">
</form>
<input type="button" onclick="test()" value="Click">
</body>
</html>
(1)
function test(){
alert(document.form1.fpdm.value)
}
报错:undefined;
同一个表单多个同名的就报错,不会自动取第一个对象。
(2)
function test(){
alert(document.getElementsByName("fpdm")[0].value)
}
ok
分享到:
相关推荐
if (document.form.count.value > 100 || document.form.count.value < 1) { alert("输入数值不能小于零大于100!"); document.form.count.focus(); return false; } if (document.form.MESSAGE.value....
if (document.form1.u.value=="") { alert("您还没有输入您的用户名呢!"); document.form1.u.focus(); return; } if (document.form1.p.value=="") { alert("您还没有输入你的密码呢!"); document.form1...
document.form1.data.value+=document.form1.v0.value; } function append1(){ document.form1.data.value+=document.form1.v1.value; } function append2(){ document.form1.data.value+=document.form1.v2....
1、理解document.all[] 从IE4开始IE的object model才增加了document.all[],来看看document.all[]的Description: Array of all HTML tags in the document.Collection of all elements contained by the object. ...
// if (document.form1.User.value.length|| document.form1.User.value.length>15) // { // alert("用户名长度限制在4-15位!"); // form1.User.focus(); // return false; // } if...
if (document.form.count.value > 100 || document.form.count.value < 1) { alert("输入数值不能小于零大于100!"); document.form.count.focus(); return false; } if (document.form.MESSAGE.value.length) { ...
document.execCommand()的用法
<input type="button" value="前插入" onclick="appendBefore('innerDiv', document.form1.field1.value);"> <input type="button" value="中插入" onclick="insertWithin('innerDiv', document.form1.field1....
win7中vfp软件安装后出现 0: 找不到MSXML2.DOMDOCUMENT.4.0类定义,此中是Dll文件下载,直接放在c:\windows\system目录下即可!msxml4.cab
var YYYYvalue = document.form1.YYYY.options[document.form1.YYYY.selectedIndex].value; if (YYYYvalue == ""){ var e = document.form1.DD; optionsClear(e); return;} var n = MonHead[str - 1]; if (str ==...
document.layers(1) transcode
JS中关于document.all的详解
html中的内容直接下载到excel中的demo,替换 document.execCommand(‘saveAs’)方法
火狐、谷歌、IE关于document.body.scrollTop和document.documentElement.scrollTop 以及值为0的问题
var YYYYvalue = document.form1.YYYY.options[document.form1.YYYY.selectedIndex].value; if (YYYYvalue == ""){ var e = document.form1.DD; optionsClear(e); return;} var n = MonHead[str - 1]; if (str =...
实际上,document 和 window 这两个对象的区别已经包含了这个问题的答案。 document 表示的是一个文档对象,window 表示一个窗口对象。 一个窗口下面可以有很多的document对象。每个document 都有 一个URL。 但是,...
1.document.formName.item("itemName") 问题 说明:IE下,可以使用document.formName.item("itemName")或document.formName.elements["elementName"];Firefox下,只能使用document.formName.elements["elementName"]. ...
1、C++ (*.c;*.cpp;*.h;*.hpp) 2、Fortran (*.for) 3、Java (*.java) 4、Pascal (*.pas;*.dpr;*.dpk) 5、Visual Basic (*.bas) 6、x86 Assembly (*.ASM) 7、Javascript (*.js) 8、VBScript (*.vbs) ...
document.body.scrollTop用法
完整获取webBrowser1的Cookie HttpOnly的Cookie