newbiedude
09-17-2002, 12:35 AM
Hello -- my first post.
I'd like to use some JS to open popup windows. Example: a visitor clicks on a thumbnail picture (one of several on a page)
I guess I don't fully understand how JS arguments or parameters work. If I have:
<html><head><script>
function openpopup(1){
var popurl="bigthumb1.mgi"
winpops=window.open(popurl,"","width=400,height=338,")
}
function openpopup(2){
var popurl="bigthumb2.mgi"
winpops=window.open(popurl,"","width=400,height=338,")
}
</script></head><body>
pict1<a href="javascript:openpopup(1)"><img src="thumb1.gif"></a>
pict2<a href="javascript:openpopup(2)"><img src="thumb2.gif"></a></body></html>
Why doesn't each href open a unique popup for that selected link? I suppose I am using the openpopup(x) as a variable and I don't see how else to define differences between the two. I'd much like to learn how this is to work (and why the above doesn't so I don't make similar mistakes in the future.
all opinions and ideas are welcome.
thx -- new to JS
I'd like to use some JS to open popup windows. Example: a visitor clicks on a thumbnail picture (one of several on a page)
I guess I don't fully understand how JS arguments or parameters work. If I have:
<html><head><script>
function openpopup(1){
var popurl="bigthumb1.mgi"
winpops=window.open(popurl,"","width=400,height=338,")
}
function openpopup(2){
var popurl="bigthumb2.mgi"
winpops=window.open(popurl,"","width=400,height=338,")
}
</script></head><body>
pict1<a href="javascript:openpopup(1)"><img src="thumb1.gif"></a>
pict2<a href="javascript:openpopup(2)"><img src="thumb2.gif"></a></body></html>
Why doesn't each href open a unique popup for that selected link? I suppose I am using the openpopup(x) as a variable and I don't see how else to define differences between the two. I'd much like to learn how this is to work (and why the above doesn't so I don't make similar mistakes in the future.
all opinions and ideas are welcome.
thx -- new to JS