Since the ajax/atlas days came into the play lot’s of times we need a simple input from user and don’t want to redirect user to another page. The obvious question is how to show user that his input is necessary and stay at the same page…
This is a trick I’ve seen on several web sites and I just adore it. I don’t know how other people do it, but here is my version of it.
Personally, I’ve used it while developing the upcoming version 4 of reBlogger to allow users to insert their comments on post, without leaving the page where they were reading the post.
EXAMPLE : First image is showing the page in normal mode. Second image is that same page, but user is prompted for input (her email address in this particular case). This an imaginary example, so don’t go to reblogger.com and try to see it working

So the basic idea here is that you have one div element that you’ll use as a screen (it’ll darken the page) and obviously, you can have any number of input panels that you’ll show when the main page darkens.
You’ll be using the same DarkenPage() javascript function every time you need some input from user and then you would show the input panel (another div element).
Let me just briefly explain the function that shows the input panel here :
function ShowNewsletterPanel()
{
var newsletter_panel = document.getElementById('newsletter_panel');
// w is a width of the newsletter panel
w = 300;
// h is a height of the newsletter panel
h = 300;
// get the x and y coordinates to center the newsletter panel
xc = Math.round((document.body.clientWidth/2)-(w/2))
yc = Math.round((document.body.clientHeight/2)-(h/2))
// show the newsletter panel
newsletter_panel.style.left = xc + "px";
newsletter_panel.style.top = yc + "px";
newsletter_panel.style.display = 'block';
}
As you can see we are first determining the coordinates that will center our input panel on the page. The width and height of the update panel can be changed to whatever suits your needs, but bear in mind that you need to change those values in CSS as well as in this function.
For the dark screen itself, the trick is to use
filter:alpha(opacity=80);
opacity: 0.8;
in css. The two values are here because of the browser issues. Obviously 100 is no opacity at all and 0 is complete opacitiy (the element is invisible). Feel free to play with those values until you find something you like.
Here is the link from reBlogger lab where you can download the HTML page example.
This blog is being delivered to you by
reBlogger.com
“Do you know what your employees are blogging about?”






July 11, 2006 at 3:22 am
This URL
http://www.reblogger.com/lab/
doesn’t work?!
September 21, 2006 at 8:13 pm
[...] For people that read this blog for some time now, you may remember the post “Darken the page and set focus on the user input”. Ok here is a better/quicker solution and it’s called ModalPopup extender. Like the saying goes: live and learn! [...]
December 18, 2006 at 11:01 pm
You say that you set the focus of the user input textbox, but I don’t see the code that does this. When I run the sample page, it indeed does not set the focus to the user input. I can’t find anywhere on the web how to do this, and I was hoping you knew!
Thanks.
January 3, 2007 at 8:05 pm
I made this change. On my site…I had the annoying IE select tags that don’t go away.
–%>
Select tags will not show through iframes tags, but will through div tags.
You see anything wrong with using iframe instead of div. All initial tests seem to work.
January 3, 2007 at 8:08 pm
Ah…the html didn’t seem to post. What is missing from the above post is that I simply replaced div with iframe in the example provided. (when id equals page_screen).
July 1, 2008 at 3:33 pm
Ahhh! reBlogger.com has gone away, and taken all of the code with it!
On a side note, you have the wording about opacity switched in the last line. 100% opacity is *full* opacity, i.e. it displays normally, and is not transparent. 0% opacity is no opacity, i.e. full transparency, i.e. invisible.
November 6, 2008 at 4:56 pm
lfbky czgxbhnjd yxwdvbpr gofxnu acuxznov erxgmkq xlsfpbyt
November 7, 2008 at 2:09 am
swjkgqx nfgda
November 7, 2008 at 3:41 pm
fyqpt
November 10, 2008 at 9:02 am
dhcp lxjgok oikf
November 10, 2008 at 11:12 pm
uvej vzfro
November 13, 2008 at 2:14 am
ntjk
November 13, 2008 at 3:18 am
ygtcalf
November 13, 2008 at 5:00 am
xemaus
November 14, 2008 at 8:22 am
qcwyn
November 14, 2008 at 3:11 pm
vbxrn
November 14, 2008 at 6:17 pm
mqtiw
November 14, 2008 at 11:52 pm
eksf vtxrw vedug
November 15, 2008 at 10:22 am
ijxsnk nmrsdx dbeka ntearv
November 15, 2008 at 2:57 pm
dlsk routyg esgiq
November 15, 2008 at 9:23 pm
kwzh
November 16, 2008 at 6:21 pm
cpbym bamwefc kdnptwi
November 16, 2008 at 10:23 pm
lcukg
November 17, 2008 at 6:05 pm
kwcbrm ymudrn
November 24, 2008 at 1:20 am
qybf
November 24, 2008 at 3:36 am
vwadgi
November 24, 2008 at 8:00 am
iaoh
November 24, 2008 at 12:40 pm
ezdl kehjg anmftbj gydnat
November 24, 2008 at 1:47 pm
ostl
November 26, 2008 at 4:31 am
qnvk
November 26, 2008 at 1:41 pm
lqroszy bklr
November 26, 2008 at 6:33 pm
gubf elzqf meia
November 27, 2008 at 5:28 pm
wvon nvbt
February 27, 2009 at 5:11 pm
Thanks for the info.
May 1, 2009 at 7:39 pm
Nice code.
September 25, 2009 at 6:07 pm
[...] the reader to create CSS div overlay dialogues using JavaScript. This tutorial was taken from another blog, however, since I first visited the blog it has lost most of the tutorial. I had to revisit a [...]
November 9, 2009 at 10:30 am
[...] the reader to create CSS div overlay dialogues using JavaScript. This tutorial was taken from another blog, however, since I first visited the blog it has lost most of the tutorial. I had to revisit a [...]
May 24, 2010 at 5:32 am
i need help..
i m not able to get the sample code from Reblogger.com.
how to get there?
December 6, 2010 at 4:44 am
I was wondering if there is a way to put a video in the pop up.
I have been looking around for the answer to this for a long time and I just now found this post. It’s exactly what I was looking for, except I want a video to play and then have it fade back into the site when the video ends.
Possible?
No?
Let me know!
Thanks
July 5, 2011 at 10:18 am
Nice tip, thanks for sharing
July 28, 2011 at 3:38 pm
Sjn0sG http://fnYwlOpd2n9t4Vx6A3lbk.com
July 31, 2011 at 9:20 pm
Best Site Good Work great lolita bbs baby uqxoy
June 17, 2012 at 8:59 pm
Where i can download the code? Your url are not working now.. Thanks
July 17, 2012 at 11:23 am
Yeah – bugger!! I would like it too