473,804 Members | 3,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

make layer disappear after clicking document

I'm making a date picker. It shows up fine. The problem is that I want it
to disappear if I click outside the calendar itself. However, if I click
*on* the calendar itself, it should not disappear, allowing me to click a
date or cycle through the months, etc.

Thanks for help.

Matt
Jul 23 '05 #1
2 2909
mja674s wrote:
I'm making a date picker. It shows up fine. The problem is that I want it
to disappear if I click outside the calendar itself. However, if I click
*on* the calendar itself, it should not disappear, allowing me to click a
date or cycle through the months, etc.

I think your interface is unintuitive - just put a close button
on the calendar. It will take the user 1 click to close the
calendar either way. If you put a button for them to click,
then at least they know when the calendar will close and how to
make it happen with almost zero effort.

Your way, they have to guess what might happen - and learn that
you like to make things happen without making it obvious.

For the record, you must stop the calendar onclick event from
bubbling up to the document. A full explanation is here:

<URL:http://www.quirksmode. org/js/events_order.ht ml>
And some sample code:

<script type="text/javascript">

function toggle(x){
var y = document.getEle mentById(x).sty le;
(y.display == 'none')? y.display='' : y.display='none ';
}

function stopBubble(e) {
var e = e || window.event;
e.cancelBubble = true; // stops IE
if (e.stopPropagat ion) { // stops others
e.stopPropagati on();
}
}
</script>

<div
id="aDiv"
style="border: 1px dotted red;
width: 200px;
height: 200px;"
onclick="stopBu bble(event);"</div>
Thanks for help.


You're welcome.

--
Fred
Jul 23 '05 #2
Thanks for help.


You're welcome.

--
Fred


I added a close button and the functionality I was asking about.

cancelBubble is exactly what I was looking for.

Thanks Fred.

Matt
Jul 23 '05 #3

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

Similar topics

1
4341
by: ajay | last post by:
I have following code for a slide menu but i twiked it to work for a single level menu. Open it in a Browser to get a clear picture. I have 2 Qs 1) How to make first entry as non-link. i.e i want to make first text as Table Heading/menu category. For examle in the given menu i want to make a heading as "Comp. Languages" which won't be a link. 2) The position of this menu is absolute to the page. I want to make it absolute to the Table...
7
6546
by: Larry R Harrison Jr | last post by:
I am looking for javascript and a basic tutorial on how to make mouse-over drop-down menus--the type that when you "hover" over a subject links relevant to that subject "emerge" which you can then "hover" over and click. (see the links left on http://www.dpreview.com to see what I mean) I have code from smartwebby.com (DHTML) but I'm not sure if it's the best, and I'm not sure how to integrate any menus of my own into it. The code...
6
1924
by: news.versatel.de | last post by:
Hello NG, I am using javascript to open a new window like this: printpreview=window.open('printview.php','printprev','width=600,height=600'); The new window has a layer called preview: <div id="preview"></div>
4
1836
by: jsreblev | last post by:
Hi Javascript gurus: I have tried several things, using several Javascript books, but can't get this to work in Netscape (latest version) and Firefox (latest v.). It works in MIE and Opera fine. A box (defined by a css layer) is supposed to pop out to the right when the corresponding box on the far left is moused over. The first function defines a layer id to the next function which pops out the box. After debugging in Venkman, it...
3
8909
by: Benton | last post by:
Hi there, I would like to make an hyperlink invisible, or disabled, with a click. The hyperlink opens a new window (target = _blank) and once the new window is shown, I don't want the hyperlink to be active anymore. How can I do this? Thanks in advance,
3
6409
by: Merlin | last post by:
Hi there, I am trying to create a form with an dynamic field that can be shown or hidden. As I saw for example on google it is possible with JS to show a layer and move the content underneath that layer further down uppon showing this layer. When a person closes that layer the content underneath the layer moves up again and closes the empty space. How is this possible? I am playing around with some code I am posting with this thread....
1
16144
by: gammajonny | last post by:
Im 14 yrs old and just make web sites for fun really, i use html css and java script at the moment but im just starting java. I live in Exeter in the uk. That me basicly. My first question is- Using css I've made a visible and hidden layer. Using Js i want to make the hidden layer visible by clicking on the visible layer. I have tryed this: <div id="box1" <a href="javascript:showLayer('box5');"> <span class="1"><center>Places to...
3
4142
by: Max58kl | last post by:
Hi I am currently trying to create a FAQ webpage. At the moment the code I have lets me click on the Questions which successfully shows and hides the <DIV> tags containing the Answers. But what I would like is to have the answers also collapse and expland, similar to the small plus and minus signs in Window Explorer. I'm sure it can be done using the CSS rules display: block; and display: none but I'm not sure how to implement it...
2
1497
by: Bill77 | last post by:
<!--Force IE6 into quirks mode with this comment tag--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <style type="text/css"> a.img-border img, a.img-border:link img{border:12px solid #6040c0;}
0
9708
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10589
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10327
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.