maryb86
12-11-2006, 02:11 AM
Hi,
I have javascript that works on all links in an html. It is below:
<script type="text/javascript">
<!--
window.onload=function() {
var mywindow;
var w=656;
var h=454;
var l=10;
var t=10;
var features='width='+w+',height='+h+',left='+l+',top='+t;
var ar=document.getElementsByTagName('a');
for(c=0;c<ar.length;c++) {
ar[c].onclick=function() {
if(mywindow) {
mywindow.close();
}
mywindow=window.open(this.href,'',features);
mywindow.focus();
return false;
}
}
}
//-->
</script>
The code makes the link open in a new pop up window with a certain size. When you click on another link, it opens in that same pop up window and is on top.
This code used to be used in iframe html pages, so it worked fine. But now i'm converting everything to a different layout so I need the javascript to only work on certain links on the page. How can I direct this coding to only certain links? Is there some kind of name feature? I don't know anything about javascript!
I have javascript that works on all links in an html. It is below:
<script type="text/javascript">
<!--
window.onload=function() {
var mywindow;
var w=656;
var h=454;
var l=10;
var t=10;
var features='width='+w+',height='+h+',left='+l+',top='+t;
var ar=document.getElementsByTagName('a');
for(c=0;c<ar.length;c++) {
ar[c].onclick=function() {
if(mywindow) {
mywindow.close();
}
mywindow=window.open(this.href,'',features);
mywindow.focus();
return false;
}
}
}
//-->
</script>
The code makes the link open in a new pop up window with a certain size. When you click on another link, it opens in that same pop up window and is on top.
This code used to be used in iframe html pages, so it worked fine. But now i'm converting everything to a different layout so I need the javascript to only work on certain links on the page. How can I direct this coding to only certain links? Is there some kind of name feature? I don't know anything about javascript!