给函数做一个返回值,然后判断返回值就行了。
function closeMsg()
{
var retVal=false
$("msgdiv").style.width=parseInt($("msgdiv").style.width)- 20+"px"
$("msgdiv").style.height=parseInt($("msgdiv").style.height)- 15+"px"
if(parseInt($("msgdiv").style.width)<=0)
{
document.body.removeChild(GetId("msgdiv"))
document.body.removeChild(GetId("maskdiv"))
retVal=true
}
else
{
setTimeout("closeMsg()",30)
}
return retval
}
if(changeMsg()){
document.getElementById("msgdiv").appendChild(thObj)
document.getElementById("msgdiv").appendChild(bodyObj)
}
扩展资料:
event.result这个属性包含了当前事件事件最后触发的那个处理函数的返回值
如果为DOM元素的同一事件类型绑定了多个事件处理函数,你可以使用result属性获取上一个事件处理函数执行的返回值。
<!DOCTYPE html>
<html>
<style>
</style>
<head>
<meta charset="UTF-8">
<title>演示文档</title>
<script type="text/javascript" src="jquery-3.1.1.min.js"></script>
<style type="text/css">
input{width: 100pxheight: 30px}
div{width: 100pxheight: 100pxborder:1px solid green}
</style>
</style>
</head>
<body>
<h3>jQuery事件对象</h3>
<div id="div1"><p id="pid"></p></div>
<input id="btn1" type="button" value="事件对象">
<script type="text/javascript">
$(function(){
$('#btn1').click(function(){
// return 100
return true
})
$('#btn1').click(function(e){
// alert(e.result)
if (e.result) {
alert('进入下一关!')
}else{
alert('Game Over!')
}
})
})
</script>
</body>
</html>
用开发工具里面的快速查询来实现,前提是你用了Eclipse 或者MyEclipsectrl+H 中的File Search
在输入框 Containing text 里面 【填写你的方法名称】
在File name patterns 中 输入*.js