View Full Version : Correct code to use for a pop-up?
ogden2k
06-21-2003, 09:01 PM
What's the correct XHTML way to use a popup window?
This isn't for ads. I am using this so if someone clicks on a link a little window will come up with special information...
Thanks
shlagish
06-21-2003, 10:05 PM
I think it's onClick="window.open('etc...')" with a return false statement...
cg9com
06-21-2003, 10:29 PM
If you are talking about the target="" attribute, it cannot be used in a strict document type.
zoobie
06-22-2003, 11:01 AM
I'd stay away from popups...Everyone is turning them off. :D
ogden2k
06-23-2003, 12:43 AM
Not strict, but transitional. They aren't pop up adds.
What I want is how Best buy does their pop-ups. When you want to see a bigger image, it pops up in a new window.
MotherNatrsSon
06-23-2003, 01:33 AM
That is just a link with target="_blank". You turn the image into a link. Like this:
<a href="http://myimageBIG.jpg" img src="myimagesmall.jpg" target="_blank">
MNS
edit:
If you use the javascript that slagish started to give you, you can control the window size that opens........
tommysphone
06-23-2003, 02:12 PM
<a
href="http://google.com/"
onclick="window.open(this.href, 'popupwindow', 'width=400,height=300,scrollbars,resizable');
return false;"
>
Click me any way you desire, now or later, bookmarked or not.
I will not attempt to control you, nor punish you, for I am a
simple hyperlink; eager to do your bidding, while remaining ever
helpful. I anticipating desires, but never trample possibilities.
This is the way of the Link.
</a>
Credit to another for the wording.
ronaldb66
06-23-2003, 02:28 PM
The target attribute is removed from the XHTML 1.1 standard because of the general approach that the user is the one deciding whether or not a link should be opened in a new window or not. Furthermore, it's the user that determines which size and decoration that window should have.
Wanting to control new windows opening and controlling their size, chrome, etc. is an attempt to take away those decisions from the user. Think of it what you want, but that's the basic idea.
MotherNatrsSon
06-23-2003, 03:57 PM
So how do you open links in a new window in xhtml then? I like off site links from my links page to open in a new window.
MNS
pardicity3
06-23-2003, 04:07 PM
You can always use javascript seeing as a pop-up that comes from a clicked link usually won't get blocked. But then again I don't like using javascript unless I have to. I personally see no problem with having a link that takes the browser to a page on a different site than mine.
There are ways for the user to open links in a new window. On windows (the only OS I know :() you just righ-click on a link and choose "Open in new window". The user should decide when they want a new window. When I am on my grandfathers computer I hate automatically opened new windows. His computer flat out can't handle it. If I want a new window, I will open one.
Surf Boy
06-23-2003, 04:53 PM
How do you get the pop up window to sit in the center of the screen?
shlagish
06-23-2003, 04:59 PM
Also, if target="..." is out, how can you make a link open in another frame? (How is a nav. bar going to work?)
Will you HAVE to make javascript?
Will this still be available (I don't know if this is the good syntax and everything, but the real way resembles this I think)?
<a href="link.html" onClick="javascript: top.mainframe.location=this.href">link</a>
pardicity3
06-23-2003, 05:16 PM
You would use the XHTML Frameset doctype which still allows for the target attribute. Though, frames have come to the point where they aren't as useful as they used to be.
shlagish
06-23-2003, 05:25 PM
I find them usefull, what would you use instead?
pardicity3
06-23-2003, 06:15 PM
I just use php to include a navbar file into my html. That way I still only have one navigation file to update. Also, if for some reason I wanted the navbar to be fixed and not scroll with the rest of the page, I could just use the css property position: fixed;
shlagish
06-24-2003, 02:26 AM
So you HAVE to ues PHP now? I thought it was an option.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.