473,396 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

wait on button click

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
Jun 27 '08 #1
2 6976
Ugo
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.
maybe, it's sufficient to use event handler "onclick", so:

<div id="layer"></div>
<input type="button"
value="hide"
onclick="document.getElementById('layer').style.vi sibility='hidden';"
/>
Jun 27 '08 #2
SAM
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
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Michael Johnson Jr. | last post by:
I am trying to handle a button click event, which updates a web control table with data. The button is dynamically created in the table itself. When I call updateTable() in the Page_Load the new...
4
by: Mark Lingen | last post by:
I've found a problem with postback event handling and webcontrol buttons. Try out the following code in an ASP.Net project and you will see. Create a web project in VB.Net and drop this code...
11
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
3
by: Imran Aziz | last post by:
Hello All, I have a search text and button that post data and my button handler filters the repeater control. However when the button is clicked the first time. The page_load event is being called...
7
by: code100579 | last post by:
Hi there, sorry if this is a really simple question. I need to write code for: If a button is pushed and then one variety of other buttons is pushed then certain options on the program will...
7
by: =?Utf-8?B?bWFydGluMQ==?= | last post by:
Hi, All, I create button in the code ( Dim Button as new Button), not using button web component (means not drap button and drop it ont he webform), after that I try to use button_click event,...
3
by: GauravGupta | last post by:
i want to know that is it posible to call button click event before page load event on post back.... please help me....
10
by: Sebouh | last post by:
Hi guys. I don't know how to implement this so i was hoping if any of you can help me. I have a code like this one: public static void main (String args) { //create frame and button ...
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.