Very nice, though it would be even nicer were your JavaScript to be external.
Here's one way of doing that...
In your (X)HTML, assign a class of "popup" to any links that you want to open in a new window:
<a href="foo.bar" class="popup">link text</a>
Then in a JavaScript file called from the <head> of the document:
function popUps() { if (!document.getElementsByTagName) return false;
var lnks = document.getElementsByTagName('a');
for (var i=0;i<lnks.length;i++) {
if (lnks[i].className == 'popup') {
lnks[i].onclick = function () {
window.open(this.getAttribute('href'),'popup');
return false;
}
lnks[i].onkeypress = lnks[i].onclick;
}
}}
window.onload = popUps();
-- Jeremy Keith
a d a c t i o
http://adactio.com
****************************************************** The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ******************************************************
