473,385 Members | 1,396 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,385 software developers and data experts.

Pop up with greyed out background

KeredDrahcir
426 256MB
I'd like to have a link that opens up in a pop up window, but while the window is open, I want to page that linked to it to be greyed out.
I found a script that would grey out the page but that was deigned to be toggled by a button so I could grey out the page and open the popup but when I closed the popup I couldn't get the page back.
I tried using a DHTML lightbox that greys out the page but I can only load images and not exteral pages in it.

Is there a way I can do this? I'm using php but to do this I would like to use JavaScript.
Aug 27 '10 #1
22 5730
Did u mean a transparent-black layer?
You can do this using CSS, and close the layer using JS
Aug 27 '10 #2
KeredDrahcir
426 256MB
Yes, that right. Can I close the layer by closing the popup window?
Aug 27 '10 #3
Yes, of course, just set the obj.className = 'something';
Aug 27 '10 #4
KeredDrahcir
426 256MB
I'm not sure I understand. You couldn't give me some sample code please?
Aug 27 '10 #5
First, did u mean this effect?

Aug 27 '10 #6
There can also a full page layer
Aug 27 '10 #7
KeredDrahcir
426 256MB
I want to page to look like a disabled form element.
Aug 27 '10 #8
So, white background???
Aug 27 '10 #9
Also note, the element(form) behind the black background is disabled!
Aug 27 '10 #10
KeredDrahcir
426 256MB
Yes. I think so.
Aug 27 '10 #11
KeredDrahcir
426 256MB
I found this script to grey out the background.
Expand|Select|Wrap|Line Numbers
  1. function opacity(id, opacStart, opacEnd, millisec) 
  2. //speed for each frame 
  3.   var speed = Math.round(millisec / 100); 
  4.   var timer = 0; 
  5.  
  6. //determine the direction for the blending, if start and end are the same nothing happens 
  7.   if(opacStart > opacEnd) 
  8.   { 
  9.     for(i = opacStart; i >= opacEnd; i--) 
  10.     { 
  11.       setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
  12.       timer++; 
  13.     } 
  14.   //make 'remove' button an 'undo' button
  15.     add_restore = id+'_remove';
  16.     restore = document.getElementById(add_restore);
  17.     restore.innerHTML = "undo";
  18.     restore.onClick="";
  19.     restore.onClick="opacity('t1',20,100,500)";
  20.   } 
  21.   else if(opacStart < opacEnd) 
  22.   { 
  23.     for(i = opacStart; i <= opacEnd; i++) 
  24.     { 
  25.       setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
  26.       timer++; 
  27.     }
  28.   //make 'undo' button return to 'remove' button
  29.     add_restore = id+'_remove';
  30.     restore = document.getElementById(add_restore);
  31.     restore.innerHTML = "remove";
  32.     restore.onClick="";
  33.     restore.onClick="opacity('t1',100,20,500)"; 
  34.   } 
  35. }
  36. //change the opacity for different browsers 
  37. function changeOpac(opacity, id) 
  38.   var object = document.getElementById(id).style; 
  39.   object.opacity = (opacity / 100); 
  40.   object.MozOpacity = (opacity / 100); 
  41.   object.KhtmlOpacity = (opacity / 100); 
  42.   object.filter = "alpha(opacity=" + opacity + ")"; 
  43. }
  44.  
It has the greyed out effect I want but I need to be able to set it back when I close the popup rather than using a button as is done here.
Aug 27 '10 #12
KeredDrahcir
426 256MB
Can I use an onclose event that will activate in a different browser?
Aug 27 '10 #13
omerbutt
638 512MB
if you are trying to load an html page which is not outside your domain you can use thickbox here is an example you see here and click onthe link name View Property Detail in front of any of the properties displayed
regards,
Omer Aslam
Aug 27 '10 #14
KeredDrahcir
426 256MB
Thanks, I'll give it a go. By the way, is there a way to force a page to refresh?
Aug 27 '10 #15
omerbutt
638 512MB
obviously you can , in javascript you are asking i think
Expand|Select|Wrap|Line Numbers
  1. location.reload()
  2.  
Aug 27 '10 #16
KeredDrahcir
426 256MB
When I refresh by clicking on the refresh button or pressing F5 the page refreshes and then takes you to where you were before. The
Expand|Select|Wrap|Line Numbers
  1. location.reload();
function, take me back to the top of the page and leaves me there. Is they any way round that?
Aug 31 '10 #17
KeredDrahcir
426 256MB
Another question, if you've put something on the onunload, I need it to happen is the user closes the window. Can I overide that, if they do something else?
Aug 31 '10 #18
omerbutt
638 512MB
i am not sure about it but try using
Expand|Select|Wrap|Line Numbers
  1. location.replace(window.location.href);
  2.  
and could not get the last post what are you trying to say
regards,
Omer Aslam
Aug 31 '10 #19
KeredDrahcir
426 256MB
I'll try your suggestion. Don't worry about the last post.
Aug 31 '10 #20
omerbutt
638 512MB
if you were using the <a> links as like
<a href="#panel1">Panel 1</a>
then it would work i think that is you were looking for
Regards,
Omer Aslam
Aug 31 '10 #21
KeredDrahcir
426 256MB
That's possibly the easiest thing to do; from the way my site operates. I'll give that one a try first.
Thanks.
Aug 31 '10 #22
omerbutt
638 512MB
yeah sure
Regards,
Omer Aslam
Aug 31 '10 #23

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Peter Foti | last post by:
I have seen lots of examples where some HTML text is replaced with a background image using CSS. For example, replacing the text of an <h1> with a graphical logo, like so: CSS: h1 span {...
12
by: Penna Elabi | last post by:
How do I create a style sheet with black background and white text?
1
by: Efkas | last post by:
My application have some level : 1. MyButton class with Label inheritance 2. MyComponent as User Control loading and positionning some of MyButtons 3. MyApp loading and positionning MyComponent ...
3
by: A.M | last post by:
Hi, Even I specifically mentioned "white" as background color of all ASP:TextBoxes of my form, Some of them come up with yellow background. I guess it should be kind of ASP.NET behaviour, but...
5
by: Juan Romero | last post by:
Hey guys, Does anyoone know how to make a control with transparent background? This is what I have so far and it doesn't work: Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)...
0
by: benfly08 | last post by:
Hi, guys. I have a program to draw bar/pie chart based on the data i hard coded in it. However, my image comes with "BLACK" background color. I don't know how to fix this. The code snippet is...
2
by: Niu Kun | last post by:
Dear all, I'm trying to draw many overlapped PNG files with transparent background in imagebox control. But the transparent background in this control is rendered as the main control's...
1
by: nicky77 | last post by:
Hi, I've created a nav bar using a background image for rollover effects. Everything works as I had hoped, however, for some reason it seems that an area of whitespace (the same size of the...
1
by: deshg | last post by:
Hey everyone how are you all doing? I am trying to use the imagerotate GD function to place an image on top of another image at an angle. Obviously when it rotates an image it creates a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.