Hey, on my most recent design I have some links that I would like opened in a new window, however if I add the target attribute it says that it doesnt exist. i have looked but cant find a way around opening links in a new window? Anyone know how? Thanks.
Announcement
Collapse
No announcement yet.
target="_blank" in XHTML 1.0 Strict
Collapse
X
-
target="_blank" in XHTML 1.0 Strict
PHP Weekly - A PHP Developers Resource
PHP 5.1.4 and Ruby on Rails web hosting
Moderator of PHP and Work offers and Requests
Install Apache/PHP/MySQL (by marek_mar) | TinyPlugin ArchitectureTags: None
-
xhtml :: attributes . tags . <abbr> vs. <acronym> CSS :: Box Model Hack
[CF T-Shirts] [CP Resources] [ithium hosting] [A New Generation of Tree Menu]
-
Code:target-new: new
David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!
Comment
-
ok thanks for that, the only problem is most of my links dont actually have a class name, does this mean I would need to make a class for the links?PHP Weekly - A PHP Developers Resource
PHP 5.1.4 and Ruby on Rails web hosting
Moderator of PHP and Work offers and Requests
Install Apache/PHP/MySQL (by marek_mar) | TinyPlugin Architecture
Comment
-
Hi there missing-score,
This code does not rely on 'class' but on tag name...
Code:[color=navy]<script type="text/javascript"> //<![CDATA[ function setTarget(){ var a = document.getElementsByTagName("a"); for(var i = 0;i < a.length;i++){ a[i].target = "_blank"; } } //]]> onload=function() {setTarget();} </script>[/color]
cthead
~ the original bald headed old fart ~
Comment
-
cheers thanks ill get it added soonPHP Weekly - A PHP Developers Resource
PHP 5.1.4 and Ruby on Rails web hosting
Moderator of PHP and Work offers and Requests
Install Apache/PHP/MySQL (by marek_mar) | TinyPlugin Architecture
Comment
-
Thanks, it works! however I will make a separate class for new window links as some links I want to open in the same window so It will just make life easier.
Thanks for your help
EDIT: Got it working, and I will upload it tomorrowLast edited by missing-score; Mar 7, 2004, 06:02 PM.PHP Weekly - A PHP Developers Resource
PHP 5.1.4 and Ruby on Rails web hosting
Moderator of PHP and Work offers and Requests
Install Apache/PHP/MySQL (by marek_mar) | TinyPlugin Architecture
Comment
-
I can see your point, and I know if people are going to leave my site then a new window wont stop them... but I would rather have off site links open in a new window, and also it allows me to break out of the frame I am stuck in for the off site links.PHP Weekly - A PHP Developers Resource
PHP 5.1.4 and Ruby on Rails web hosting
Moderator of PHP and Work offers and Requests
Install Apache/PHP/MySQL (by marek_mar) | TinyPlugin Architecture
Comment
-
I may be wrong, but you don't need a script for this. Just modify the DTD to suit your needs. The W3 Validator didn't have a problem with this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [<!ATTLIST a target CDATA #IMPLIED>]>
Comment
-
target-new:
is that a forthcoming CSS property? i hope they reconsider. i find even the slight blurring of presentation and behavior with :hover a bit odd. a more knowledgeable gentleman than myself has written an article on the topic that's worth checking out. he doesn't draw any conclusions necessarily about whether even :hover should or should not be a part of CSS, so it's more of a 'get ya thinking' type piece. very interesting observations. for instance, the CSS methods for rollout menus are extremely efficient and compact on the code side, but what sense does it make using the presentation layer to control behavior? etc.
Separating Behavior and Presentation Got something to say? Share your comments on this topic with other web professionals In: Columns > Keep It Simple By Peter-Paul Koch Published on May 19, 2004 The story so far: Separating presentation and structure started in the early days of the CSS revolution. It turned out to be rather ... Read more
Comment
-
Originally posted by missing-scoreI would rather have off site links open in a new window
Comment
-
Originally posted by ]|V|[agnusBecause, as he said, he is using XHTML strict which has deprecated the "target" attribute..
are supported in the w3c.org XHTML 1.0 strict doc type.
(I have stared and stared at what appears to be English in
- http://www.w3schools.com/xhtml/xhtml_reference.asp
- http://www.w3.org/MarkUp/
- http://www.w3.org/TR/2002/REC-xhtml1...L-1.0-Frameset
and cannot understand how one would get links to open in various frames if target= is not allowed - not that it matters though - I've never been a big fan of frames anyway)
And personally, I would still advocate the use of title="this is an offsite link" over opening in a new window.
Comment
Comment