能否动态禁用某个function,该怎么解决
能否动态禁用某个function
js代码中定义了一个function,比如
function test()
{
alert( 'test ');
}
我能否在body的onload()事件里面写一个函数来禁用这个test()函数呢?
------解决方案--------------------
<html>
<script>
function test()
{
alert( 'test ');
}
</script>
<body onload= "test=function(){} ">
<button onclick= "test() "> test </button>
</body>
</html>
js代码中定义了一个function,比如
function test()
{
alert( 'test ');
}
我能否在body的onload()事件里面写一个函数来禁用这个test()函数呢?
------解决方案--------------------
<html>
<script>
function test()
{
alert( 'test ');
}
</script>
<body onload= "test=function(){} ">
<button onclick= "test() "> test </button>
</body>
</html>