Jump to content

qustion about the <a> tag with XHTML 1.0 Strict


Laurent

Recommended Posts

Hi,I'd like to do an XHTML 1.0 web site that uses the Strict DTD but i have a stupid question about the <a /> tag (link). How can I specify the name of the frame in which the link will be open if the attribute "target" is not in the Strict DTD ?ThanksLaurent

Link to comment
Share on other sites

Well, you don't use frames in XHTML strict on the first place :) .

Link to comment
Share on other sites

thirdly, here is very simple but good script to do it :)

var elms = document.getElementsByTagName('a'); for (var i = 0; i < elms.length; i++){  elms[i].target = elms[i].getAttribute('rel'); }

Save code to external javascript file (name as target.js or something) and include that JS-file just before </body> tag. (after last a-element of Your document).Include tag:<script src="target.js" type="text/javascript"></script>modify Your links like:<a rel="_blank" href="http://www.google.ru">Google</a>and Your links will open in new window. (rel = target)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...