validating href="#"

Busy's picture

He has: 6,151 posts

Joined: May 2001

I was updating some pages on one of my sites which validated to html specs, but thought i'd go up tp XHTML as its only adding slashes on img, meta and inut tags etc.
anyways, <a href="#" onmouseover ....' wont validate, but if i take the href="#" <a mouseover ...'off it will, but NS4.7 doesn't support the anchor tag as mouseover (a).

Anyone know a work around for XHTML validation (Transitional).

and can anyone tell me if a mouseover tag without the href part works on mac or any other browser, I only have NS4.7, Opera6 and IE5.5 and NS6 but can't try NS6 as have to much open

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

If you're using href="#" because of DHTML, you can put non-DHTML help pages in the href (I do this on my old zerocattle.com/ site, if you mouseover a red term it's a definition, for people without JavaScript installed, it's a link to a page of terms).

If you're using it for a popup window and such, again, put a valid link in the href: zerocattle.com/examples/popUp.html

What are you using it for?

Busy's picture

He has: 6,151 posts

Joined: May 2001

http://www.munchtech.com/models/pic01.html the "rear" "under" and "motor" are the mouseovers, none are links

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Think about how it would work with JavaScript off...

Then put links in. Using return: false; in the onclick or onmouseover portion will prevent that from working. Additionally, for those without JavaScript on or functioning, would be able to view the images. So link to the images themselves in the href, which solves your problem and improves your accessibility many times over.

Smiling S

Edited to add: if you link to a static page with the surround working, that would keep the look and feel for the other people as well.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Another solution is a bit of a hack, using the pseudo-element :hover for things other than a -- but really, you don't want to bother with that sort of thing when you can make it valid and accessible so easily.

They have: 447 posts

Joined: Oct 1999

to prevent an anchor from being a link i usually do:

Busy's picture

He has: 6,151 posts

Joined: May 2001

Thanks Suzanne and Rob

Busy's picture

He has: 6,151 posts

Joined: May 2001

I had another look at my pages today and the weird thing is

dk01's picture

He has: 516 posts

Joined: Mar 2002

That is true because xhtml says no caps in html attribs.
-dk

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.