9 replies [Last post]
n8gz4ez
n8gz4ez's picture
Offline
Leader
Last seen: 14 years 8 weeks ago
Timezone: GMT-6
Joined: 2005-06-13
Posts: 802
Points: 0

Can anyone here recommend a method for building a popup page? Do I need to use JS for this?

I found this popup window generator, but I wonder if there is a better method.

http://javascriptkit.com/popwin/index.shtml

Also, I noticed that the above link does not have a close window button for its popup window . . .

Thanks!

This is my big chance . . . yep, I blew it . . .

Tags:
Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 8 years 11 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

building a popup window?

This is a simple one I have used and modified, although I'm sure there are better methods, tend not to think they're a great idea or use them myself it's a user decision.

I would not use the one you linked to, it doesn't degrade gracefully.

 
<script  type="text/javascript">	  
<!-- 
function n_window(theurl) 
{ 
 // set the width and height 
 var the_width=335; 
 var the_height=355; 
 // set window position 
 var from_top=170; 
 var from_left=460; 
 // set other attributes 
 var has_toolbar='no'; 
 var has_location='no'; 
 var has_directories='no'; 
 var has_status='no'; 
 var has_menubar='no'; 
 var has_scrollbars='no'; 
 var is_resizable='no'; 
 // attributes put together 
 var the_atts='width='+the_width+',height='+the_height+',top='+from_top+',screenY='+from_top+',left='+from_left+',screenX='+from_left; 
 the_atts+=',toolbar='+has_toolbar+',location='+has_location+',directories='+has_directories+',status='+has_status; 
 the_atts+=',menubar='+has_menubar+',scrollbars='+has_scrollbars+',resizable='+is_resizable; 
 // open window 
 window.open(theurl,'',the_atts); 
} 
//--> 
</script> 
======================= 
Link: 
 
<a  href="page.htm" onclick="n_window('page.htm'); return false" onfocus="this.blur()">text link</a> 
 
======================= 
 
Close window button: 
 
<form action="none">
<div> 
<input   type="button" value="Close Window" onclick="self.close()" /> 
</div>
</form> 

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

firstreflex
firstreflex's picture
Offline
Enthusiast
Brooklyn USA
Last seen: 16 years 3 weeks ago
Brooklyn USA
Timezone: GMT-5
Joined: 2003-10-21
Posts: 104
Points: 0

building a popup window?

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 8 years 11 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

building a popup window?

Nate I would read through the second link that firstreflex provided it's more up to date using the DOM.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

n8gz4ez
n8gz4ez's picture
Offline
Leader
Last seen: 14 years 8 weeks ago
Timezone: GMT-6
Joined: 2005-06-13
Posts: 802
Points: 0

building a popup window?

Hugo wrote:
This is a simple one I have used and modified, although I'm sure there are better methods, tend not to think they're a great idea or use them myself it's a user decision.

Nate I would read through the second link that firstreflex provided it's more up to date using the DOM.

I agree with you Hugo, I'm not a big fan of the popup. In this case it is being used to display an excerpt from a book, similar to amazon.com. Since the user will already be on the $product page, they don't want user to go back.

Laughing out loud I just finished implementing the first script . . . now I am off to implement firstreflex's link.

Thanks a lot for the recommendations! Smile

Nate

This is my big chance . . . yep, I blew it . . .

n8gz4ez
n8gz4ez's picture
Offline
Leader
Last seen: 14 years 8 weeks ago
Timezone: GMT-6
Joined: 2005-06-13
Posts: 802
Points: 0

building a popup window?

I have one question about firstreflex's popup link.

http://icant.co.uk/forreview/popstuff/popstuff.html

You can see it in action here:

http://icant.co.uk/forreview/popstuff/popmother.html

The popup has a "Close window" link at the top. Is there a way position that link, and make it an image instead of text?

This is my big chance . . . yep, I blew it . . .

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 8 years 23 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

building a popup window?

I thought using target="_blank" didn't validate?

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

n8gz4ez
n8gz4ez's picture
Offline
Leader
Last seen: 14 years 8 weeks ago
Timezone: GMT-6
Joined: 2005-06-13
Posts: 802
Points: 0

building a popup window?

Tyssen wrote:
I thought using target="_blank" didn't validate?


Not with a strict doctype . . . except there is a "workaround."

http://www.zeldman.com/daily/0503a.shtml#strictlyspeaking

This is my big chance . . . yep, I blew it . . .

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 8 years 23 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

building a popup window?

:? Doesn't sound like a very suitable workaround. Seems like it would cause more problems than it solves.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

n8gz4ez
n8gz4ez's picture
Offline
Leader
Last seen: 14 years 8 weeks ago
Timezone: GMT-6
Joined: 2005-06-13
Posts: 802
Points: 0

building a popup window?

Yeah, I am comfortable using a transitional doctype.

Validation message: "This Page Is Valid -//golem.ph.utexas.edu//DTD XHTML 1.1 plus Target 1.0//EN!

The document located at <http://golem.ph.utexas.edu/~distler/blog/files/zeldman.html> was checked and found to be valid -//golem.ph.utexas.edu//DTD XHTML 1.1 plus Target 1.0//EN. This means that the resource in question identified itself as "-//golem.ph.utexas.edu//DTD XHTML 1.1 plus Target 1.0//EN" and that we successfully performed a formal validation using an SGML or XML Parser (depending on the markup language used)."

Also, I've read a few posts about xhtml 1.1 causing some headaches . . .

This is my big chance . . . yep, I blew it . . .