<html>
<head>
<script type="text/javascript">
function openInIframes(e) {
// find the link that was clicked on and grab the value of it's href attribute (working around different browser event models)
if (!e) var e = window.event;
var href = (e.target || e.srcElement).href;
// find the iframes in the page and set them all to display the link
var iframes = document.getElementsByTagName('iframe');
var n = iframes.length;
while (n--) {
iframes[n].src = href;
}
// because we're using javascript to navigate to the link (by displaying it in the iframes) we don't want the browser to follow the link like normal
if (e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
}
}
onload = function() {
// find the links with the right target attribute and setup their onclick events
var links = document.getElementsByTagName('a');
var n = links.length;
while (n--) {
if (links[n].target && links[n].target == 'iframe') {
links[n].onclick = openInIframes;
}
}
};
</script>
</head>
<body>
<iframe width="400" height="300"> </iframe>
<iframe width="400" height="300"> </iframe>
<p><a href="http://www.google.com" target="iframe">Google</a> <a href="http://www.flashkit.com" target="i
frame">Flashkit</a></p>
</body>
</html>