[SOLVED] Closing Div Popup Window

This is a discussion on "[SOLVED] Closing Div Popup Window" within the JavaScript Forum section. This forum, and the thread "[SOLVED] Closing Div Popup Window are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 13th, 2007, 06:14
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
[SOLVED] Closing Div Popup Window

I have div floating in my page. It will be there if you have an unread message in your PM inbox.

What I want to do is to put a CLOSE button to it so that I could close the irritation popup from blocking up my content area.

The code (from my tag team mate, Rakuli)
Code: Select all
<script type="text/javascript">
        // Place this just below the </body> tag
        if (showPMpopup)
        {
            document.write('<div style="width:300px;height:140px;padding:2px;border:solid 1px #000000;background-color:#FFF;position:absolute;top:-155px;left:200px;font:small verdana;font-size:12px;text-align:center;color:#000" id="PMpopup"><h1 style="margin:0;padding:3px;background:#365c2b;border:solid 1px #000000;font:small verdana;font-size:14px;text-align:center;color:#FFF">New Private Message!</h1><br />Hai <%=pmDisplay("username")%>!<br />You have <%Response.Write(totalPM)%> new Private Message<br /><br />Read Your Message<br /><a href="my-pm-inbox.asp">Go to your Inbox</a></div>');

        // now to animate the popup
        // set some variables

        function animatedPopup(varName)
        {
           ......
           ......
         }

        // Now the actual variable is set
        var PMAnimator = new animatedPopup('PMAnimator');
        // run the function after a second
        setTimeout('PMAnimator.animatePopup()', 1000);
        }
    </script>
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote

  #2 (permalink)  
Old Dec 13th, 2007, 06:24
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Closing Div Popup Window

Hi monie,

always looking to add features to old code

change the document.write line

Code: Select all
document.write('<div style="width:300px;height:140px;padding:2px;border:solid 1px #000000;background-color:#FFF;position:absolute;top:-155px;left:200px;font:small verdana;font-size:12px;text-align:center;color:#000" id="PMpopup"><span style="float: right" onclick="this.parentNode.style.display=\'none\';">Close (X)</span><h1 style="margin:0;padding:3px;background:#365c2b;border:solid 1px #000000;font:small verdana;font-size:14px;text-align:center;color:#FFF">New Private Message!</h1><br />Hai <%=pmDisplay("username")%>!<br />You have <%Response.Write(totalPM)%> new Private Message<br /><br />Read Your Message<br /><a href="my-pm-inbox.asp">Go to your Inbox</a></div>');
    </script>
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #3 (permalink)  
Old Dec 13th, 2007, 06:30
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: Closing Div Popup Window

Thanks Rakuli!
Can I change the mouse pointer to a pointing hand from the document.write line as well?

I tried changing the <span> to <a href> but having trouble with the positioning..
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)

Last edited by Monie; Dec 13th, 2007 at 06:35.
Reply With Quote
  #4 (permalink)  
Old Dec 13th, 2007, 06:37
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Closing Div Popup Window

just add style="cursor:pointer" to the span tag
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #5 (permalink)  
Old Dec 13th, 2007, 06:42
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: Closing Div Popup Window

You are great Rakuli! Great to have you as our leader
Thanks again mate..
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing a browser without a popup.. JustinStudios JavaScript Forum 3 Mar 23rd, 2007 23:31
Got to fit the image to 800x600 popup window kivanc JavaScript Forum 2 Dec 29th, 2006 20:12
Javascript popup window with ASP madhuri.t Classic ASP 0 May 3rd, 2006 10:42
Closing a window ( created using start,stopdrag) gwx03 Flash & Multimedia Forum 6 Dec 12th, 2003 01:44
closing a window. Hatsu JavaScript Forum 11 Nov 30th, 2003 19:41


All times are GMT. The time now is 01:06.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43