A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 郑冬 中级黑马   /  2013-5-15 22:47  /  1000 人查看  /  2 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('password1').focus()
  }
function loseFocus()
  {
  document.getElementById('password1').blur()
  }
</script>
</head>
<body>
<form>
<input type="password" id="password1" value="thgrt456" />
<input type="button" value="Set focus" />
<input type="button" value="Lose focus" />
</form>
</body>
</html>
这是参考文档中的例子,可是并没有看到加了焦点和取消焦点有什么区别,求指教!

评分

参与人数 1技术分 +1 收起 理由
袁梦希 + 1

查看全部评分

2 个回复

倒序浏览
原因就是你写了方法却没有调用
<input type="button" value="Set focus" onclick="setFocus()" />
<input type="button" value="Lose focus" onclick="loseFocus()"/>

评分

参与人数 1技术分 +1 收起 理由
刘胜寒 + 1

查看全部评分

回复 使用道具 举报
如果问题已经解决了,那么大家请把帖子的类型改为“已解决”,在自己帖子的左下角点编辑,然后选择帖子的分类进行改正。{:soso_e163:}
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马