The answer to your question:

Originally Posted by
Webiter
how should this second function popup()
be identified from the first one so that they can be attached to different links?
is, as clueful hints, just give each function a different name. However, here's a different approach to the problem (also hinted at by clueful):
Code:
<script type="text/javascript">
function popup(href, w, h){
open(href, '_blank
','scrollbars=1,statusbar=0,resizable=0,width=' + w + ',height=' + h + ',left=450,top=80');
return false;
}
</script>
<li><a href="an application file" onclick="return popup(this.href, 450, 500;">Here is the popup window.</a></li>
<li><a href="another application file" onclick="return popup(this.href, 550, 600;">Here's another popup window.</a></li>
An additional thing to consider is that once you open a popup, unless it is closed, browsers will reuse it, but not resize it. If the target/name (highlighted in the above) is _blank or unique though, it will open a separate window. With _blank it will open a separate window each time either link is clicked, so you could end up with like 80 windows. You have separate windows for each link, but the total number of possible windows is endless. One could instead do:
Code:
<script type="text/javascript">
function popup(href, name
, w, h){
open(href, name
,'scrollbars=1,statusbar=0,resizable=0,width=' + w + ',height=' + h + ',left=450,top=80');
return false;
}
</script>
<li><a href="an application file" onclick="return popup(this.href, 'popup1'
, 450, 500;">Here is the popup window.</a></li>
<li><a href="another application file" onclick="return popup(this.href, 'popup2'
, 550, 600;">Here's another popup window.</a></li>
That way once one link is clicked, no matter how many times you click it, it will use the same window, but the other link will create its own, and will reuse it if it's clicked multiple times. So you end up with no more than two separate windows, and a separate window for each link.
Bookmarks