这个form表单return check(this.form)的this指向哪里?

<form action="login.do?act=login" method="post">
用户帐号
<input type=text name="userId" size="18" value="" >


登录密码
<input type="password" name="password" size="19" value=""/>
<input type=submit name="submit1" value="登陆" onclick="return check(this.form)">

</form>

阅读 4.8k
2 个回答

传入的是this

this是:

<input type=submit name="submit1" value="登陆" onclick="return check(this.form)">

任何一个表单的元素的form 都是表单本身
this.form就是:

<form action="login.do?act=login" method="post">
用户帐号
<input type=text name="userId" size="18" value="" >


登录密码 
<input type="password" name="password" size="19" value=""/> 
<input type=submit name="submit1" value="登陆" onclick="return check(this.form)">

</form>

就是 HTMLElement 的对象,就是你点击的那个input 对象

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题