专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »数据库 » js字符串函数:表单域name和js函数重名引起的问题 »正文

js字符串函数:表单域name和js函数重名引起的问题

来源: 发布时间:星期四, 2008年10月9日 浏览:247次 评论:0
无意中遇到这个问题,如下面的html代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
function add(){
alert("call add method.");
}

function input(){
alert("call input method");
}
</script>
</head>
<body>
<form>
<input type="button" name="add" value="添加" _disibledevent="alert(form1.add.value);" />
</form>
</body>
</html>
会发现事件执行的很好。

于是就想到了,

1.form是可以直接通过name来调用对应的form对象。

2.在同一form中,各个表单域又可以直接通过各自的name来调用各自的对象。

3.由于js中,函数也是对象,于是就引发了第一个代码段中的问题。

相关文章

读者评论

  • 1a(221.218.238.*) 发布于:星期一, 2008年10月27日17:40
    addd
  • 1 共1条 分1页

发表评论

  • 昵称:
  • 内容: