“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
Note that in XHTML 1.1 and higher the target="" attribute is no longer legal.
Still waiting on an answer for the alternative other than JavaScript, but I think for now I'm just going to go with that. Doesn't really matter anyway...
BTW, what exactly does the return false do? I notice it has the effect of keeping the parent window at its current location but what are the technicalities? What are we returning false to? The parent window?
You are returning false to the "onClick" event. This basically says the event has been handled, and the default handler doesn't have to do anything. If you leave it out or return true, the default action will begin. In the case of a link, the HREF action is activated.
Many people code
<a href="#" onclick="...">
mostly for browsers that require a HREF in a link. If the "return false" is left out of the "onclick", the browser goes to a null anchor. This will make the page jump to the top, or in some cases, reload.
The best of both worlds is to use a real HREF and "return false" in the "onclick". This allows browsers with javascript disabled to do something useful.
I took a class on JavaScript this semester, my exam is Thursday actually. Simple class, very very easy, and we didn't learn too many USEFUL things...some but not too many...sigh.
Web classes, the ones taught in college at least, tend to be very light in content, and even then they skip over real world stuff. You would think a teacher would have students learn to make web pages against 4.01 recommendations at this point, but they don't. Even in a class that taught one chapter of CSS, the final exam included zero CSS code. We were told to find 20 errors in the given web pages code. I found 35 errors based on 4.01 Strict and I didn't even count taking out the code that should have been done with CSS. :-)
Originally posted by spufi Web classes, the ones taught in college at least, tend to be very light in content, and even then they skip over real world stuff. You would think a teacher would have students learn to make web pages against 4.01 recommendations at this point, but they don't. Even in a class that taught one chapter of CSS, the final exam included zero CSS code. We were told to find 20 errors in the given web pages code. I found 35 errors based on 4.01 Strict and I didn't even count taking out the code that should have been done with CSS. :-)
LOL
I guess most teachers don't have a first clue about what HTML really is.
Originally posted by matthurne Note that in XHTML 1.1 and higher the target="" attribute is no longer legal.
Still waiting on an answer for the alternative other than JavaScript, but I think for now I'm just going to go with that. Doesn't really matter anyway...
BTW, what exactly does the return false do? I notice it has the effect of keeping the parent window at its current location but what are the technicalities? What are we returning false to? The parent window?
I just want to add two things to gil's excellent post. The event handlers in JavaScript are the only things that don't follow the 'capitalize each new word in the name' convention. It's document.links[1].onclick. And, it's important to remember that 12% of users do not use JavaScript and that many of those who do use JavaScript disable pop-ups. We need the link to behave like a normal link for those people. Better that then a link that does nothing at all. For those good people, the onclick handler will be ignored and the browser will simply load the document. That's why it's important to supply the URL for the HREF attribute.
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
Bookmarks