2024-03-27 17:38:06
给函数做一个
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: 100px;height: 30px;}
div{width: 100px;height: 100px;border: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>
2023-08-24 14:55:03
2022-02-16 19:56:22
2021-12-27 20:22:47
2023-10-02 08:34:51