如何使 HTML 按钮在单击时消失,然后在 2 秒后重新出现?我找到了一些方法来做到这一点,但我需要它与我已有的代码一起使用。我怎样才能做到这一点?
<script language="JavaScript">
function enableTorch(milliSeconds) {
ipwajax('enabletorch');
window.setTimeout("ipwajax('disabletorch');",milliSeconds);
}
</script>
<input type="button" style="font: bold 20px Arial" onclick="enableTorch(1500);" value="LED ON">
最佳答案
<!--
$("p").hide()
Demonstrates the jQuery hide() method, hiding all <p> elements.
-->
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("button").hide();
$("button").show(2000);/*2 sec time*/
});
});
</script>
</head>
<body>
<button>Click me</button>
</body>
</html>
此按钮将隐藏按钮并在 2 秒内重新显示
关于javascript - 使 HTML 按钮在单击时消失,然后在 X 次后重新出现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14766340/