[UPHPU] xhtml strict and open in new window
Brandon Stout
hplsbyufan at imapmail.org
Wed May 10 15:37:48 MDT 2006
The xhtml strict standard deprecates the "target" attribute for the
anchor tag (<a>). The only other way I know of to instruct the browser
to open a link in another window uses "onclick" javascript events. I
have two examples on my site:
http://mscis.org
The phpwebsite logo provides the first example. The code:
<img onmouseover="this.style.cursor='pointer'"
onclick="window.open('http://phpwebsite.appstate.edu/','_blank');"
src="themes/clean/img/logo.gif" alt="phpWebsite" />
I use "onmouseover" so people can tell it's a link. I avoid using <a
href="#"> because then the status bar shows the wrong URL - it looks
like the logo will link back to MSCIS.org. I also avoid <a
href="http://phpwebsite.appstate.edu/"> because that would redirect the
current page and open the link in another window.
The words "Glorianne Muggli" provide the second example (this time, just
text, and no image). The code:
<p>Site Logo © <a onmouseover="this.style.cursor='pointer'"
onclick="window.open('http://gloriannemuggli.com/','_blank');">Glorianne
Muggli</a>
Again, I avoid the anchor tag's "href" attribute for the same reasons.
The problems:
1. The status bar now shows nothing. I'd like it to show where the
correct URL.
2. The text link is not blue, so it's not readily apparent that it's a
link. If I make it blue using the "color" attribute, it will not change
color after clicking the link.
The question:
How can I resolve these issues, and maintain xhtml strict compliance?
Note that my website currently uses xhtml transitional, however I'm
going to migrate everything from phpwebsite into my own design, and I
want xhtml strict for that.
I'm open to javascript, css, xhtml, php, and any other solution
following my reasoning, or an entirely different method.
Thank you,
Brandon Stout
http://mscis.org
More information about the UPHPU
mailing list