Click to See Complete Forum and Search --> : XHTML 1.1 Anchors


matthurne
12-16-2002, 03:53 PM
Stefan, told you I'd be back!

I'm updating all my pages to XTHML 1.1...a particular page is a collection of links. I want the links to open in new windows when they are clicked. Prior to XTHML I could just use the attribute "target", but that is not supported in 1.1...how can I have them open in new windows? I know I could use JavaScript, and I know how to do that, but is there a way to do it with basic XHTML?

Thanks!

Rick Bull
12-16-2002, 06:08 PM
Nope, there's no HTML attribute for it in XHTML 1.0 Strict or newer. You have to use JavaScript (which is a bad idea in my opinion because Mozilla reacts to right and middle-clicks as well as left-clicks for the onclick event hander).

gil davis
12-16-2002, 06:36 PM
Originally posted by Rick Bull
because Mozilla reacts to right and middle-clicks as well as left-clicks for the onclick event hander
Gee, that kind of makes more sense to do it that way, doesn't it? After all, they *are* all "clicks". The handler can check which click it was and act accordingly (there are also other modifiers - shift, alt, cntrl - that can be used for clicks).

The "onmousedown" and "onmouseup" has always acted on all clicks.

Oh, yeah! How about "ondblclick"? I've never seen *that* work like I would expect.

Then there are people that change their mouse button definitions...
:-)

Stefan
12-16-2002, 09:59 PM
Originally posted by Rick Bull
Mozilla reacts to right and middle-clicks as well as left-clicks for the onclick event hander

That is actually considered a bug and will be fixed (mainly becuse it breaks right-click contextmenus).

onclick will eventually be triggerd only for left-click.

Stefan
12-16-2002, 10:02 PM
Originally posted by matthurne
but is there a way to do it with basic XHTML?


Currently you would have to back down to 1.0 Transitional on webpages that you require target on.
In XHTML 2.0 it will be back however together with the new X-frames (don't hold your breath though, it's due for 2004).

Rick Bull
12-17-2002, 05:22 AM
Ah I thought it may have been a Mozilla bug. Can't really understand why it hasn't been fixed yet, it must be pretty easy.

Originally posted by gil davis
Then there are people that change their mouse button definitions...
:-)

That's exactly what I've thought before. You could do a button check, but what if the right button is the one that opens it. I prefer to just let the user choose which page to open in a new window. I find it annoying now days when window open automatially.