Form 中一个输入框的名称中有冒号,怎样来访问这个输入框呢? 我遍历 forms[0] 中的变量,根据名称比较来找到那个变量,然后进行操作。不知道还有没有其它办法。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以使用input的id<input id="xxx"> 谢谢楼上的,我那里必须用名称,而且名称中必须有冒号,是 .NET 中服务器端吐出来的,不用冒号就有问题。 <form><input type=text name="aaa:bbb" value="tttt"><input type=button onclick="return c()"></form><script>function c(){ alert(document.forms[0].elements["aaa:bbb"].value);} <form><input type=text name="aaa:bbb" value="tttt"><input type=button onclick="return c()"></form><script>function c(){ alert(document.forms[0].elements["aaa:bbb"].value); alert(document.all("aaa:bbb").value); alert(document.getElementsByName("aaa:bbb")[0].value);}</script> js 无限分类 等待中..... 超链接点击颜色变化 这个图片幻灯片为何不能在FF下显示呢? js如何获取到当前显示器的长度和宽度?? 动态获取列表框中的内容 这段脚本可以解密吗? 问一个问题在线求助!! 请问这样的脚本怎样实现 赋值问题! 那位大虾可以告诉我:怎么判断一个文件是否存在. 关于正则表达式 如何将一个例如"2004-09-13 23:59"的字符串转换为一个Date对象?
<input id="xxx">
<input type=text name="aaa:bbb" value="tttt">
<input type=button onclick="return c()">
</form>
<script>
function c()
{
alert(document.forms[0].elements["aaa:bbb"].value);
}
<input type=text name="aaa:bbb" value="tttt">
<input type=button onclick="return c()">
</form>
<script>
function c()
{ alert(document.forms[0].elements["aaa:bbb"].value);
alert(document.all("aaa:bbb").value);
alert(document.getElementsByName("aaa:bbb")[0].value);
}
</script>