tshad a écrit :
Is there an easy way to wait on a button click?
I want to be able to show a div and then when the user presses the mouse
button, to then hide the div.
I can make it happen with a setTimeout to wait for 10-15 seconds, but I
would like to show it until the user presses the mouse.
<html>
<script type="text/javascript">
function hidSho(id) {
var d = document.getElementById(id).style;
d.visibility = d.visibility==''? 'visible' : '';
}
function shoHid(id) {
var d = document.getElementById(id).style;
d.visibility = d.visibility==''? 'hidden' : '';
}
</script>
<style type="text/css">
#test { visibility: hidden; border: 1px solid }
</style>
<h2 id="test">here is the test 1</h2>
<p>pass mouse <a href="#"
onmouseover="hidSho('test');"
onmouseout="hidSho('test');"
onclick="return false;">over me</a></p>
<p><button onmousedown="hidSho('test');"
onmouseup="hidSho('test');">press me</button></p>
<h2 id="test2">here is the test 2</h2>
<p><button onmousedown="shoHid('test2');"
onmouseup="shoHid('test2');">press me</button></p>
</html>
--
sm