<!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 language="javascript">
function a(){
alert("aaaaa");
}
function b(){
alert("bbbbbb");
}
</script>
</head><body>
<input type="text" onblur="a()" onclick="b()"/>
</body>
</html>应该可以用啊 lostfocus 是什么? 是失去焦点吗? 失去焦点是onblur();
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function a(){
alert("aaaaa");
}
function b(){
alert("bbbbbb");
}
</script>
</head><body>
<input type="text" onblur="a()" onclick="b()"/>
</body>
</html>应该可以用啊 lostfocus 是什么? 是失去焦点吗? 失去焦点是onblur();
解决方案 »
- 关于settimeout
- 求助 IE7地址栏问题
- 请教ie中event的使用问题。多谢!
- 求助!!AJAX 如何把document转换为流形式传给JAVA的Servlet
- window.open()的问题,大家近来看看。
- 如何在.net中用javascript将一个form的内容post到后台处理
- 求“超级表格”,急!!!
- 找javascript,asp.net二年以上经验 在深圳5K左右,QQ:15218231
- ■■请教CheckBox如何使它输入后只读状态,不能修改呢?用readonly不行,disabled可以,但不好看■■
- 请教关于jquery grid列隐藏效果
- 一个省份城市联动列表的提取 问题
- 请问在正则表达式中\1,\2...\9,$1,$2...$9的具体用法
写错了,lostfocus 就是 onblur 是onblur 是 输入框, click 事件是 按钮的。不是输入框同时又两个事件。当输入文件框文字后,光标还在文本框内时,鼠标单击 按钮,只触发了 onblur 事件代码,按钮的 click 事件
没有触发。 见下面代码
--------------------------<!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 language="javascript">
function a(){
alert("aaaaa");
}
function b(){
alert("bbbbbb");
}
</script>
</head> <body>
<input type="text" onblur="a()" /> <input id="Button1" type="button" value="button" onclick="b()"/>
</body>
</html>
分别拥有事件,不可能吧?
---
原因是似乎alert()"优先"
onblur 事件在先,click 事件 在后
在click 事件 触发前,先触发了alert(),try:<!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 language="javascript">
function a(obj){
obj.value="blur"
}
function b(){
alert("bbbbbb");
}
</script>
</head> <body>
<input type="text" onblur="a(this)" /> <input id="Button1" type="button" value="button" onclick="b()"/>
</body>
</html>