Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

wait on button click

0 views
Skip to first unread message

tshad

unread,
May 16, 2008, 4:11:37 AM5/16/08
to
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.

Thanks,

Tom


Ugo

unread,
May 16, 2008, 4:54:38 AM5/16/08
to

maybe, it's sufficient to use event handler "onclick", so:

<div id="layer"></div>
<input type="button"
value="hide"
onclick="document.getElementById('layer').style.visibility='hidden';"
/>

SAM

unread,
May 16, 2008, 11:32:33 AM5/16/08
to
tshad a écrit :

<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

0 new messages