日期:2014-05-16 浏览次数:20404 次
<!DOCTYPE html>
<html>
<head><title></title></head>
<body>
<script>
var game = {action: null};
function setAction(b)
{
function doNothing()
{
}
if (b)
{
game.action = doNothing;
alert(game.action == doNothing)
}
else
{
alert(game.action == doNothing); //返回false,太奇怪了
game.action = null;
}
}
</script>
<label for="chk">show time</label><input id="chk" type="checkbox" onchange="setAction(this.checked)"/>
</body>
</html>
var game = {action: null};
function doNothing()
{
}
function setAction(b)
{
if (b)
{
game.action = doNothing;
alert(game.action == doNothing)
}
else
{
alert(game.action == doNothing); //返回false,太奇怪了
game.action = null;
}
}
var game = {action: null};
function setAction(b){
if(!setAction.doNothing){
setAction.doNothing = function(){