Posts: 3,436
Name: Thierry
Location: I'm the uber Spaminator !
|
The easiest way to prevent this behaviour would not be to close/open another popup, but play every sounds in the same popup.
For that, you simply need to retrieve the popup reference upon opening it, which your code prevent now.
For that, you will need a javascript function that will act as a controller between the links and the popup.
Try this:
Code:
<script type=text/javascript">
var popWin = false;
function playSound(url,name,size){
popWin = window.open(url,'popWin',size);
}
</script>
<a href="javascript:playSound(url, name, size);">song 1</a>
I intentionally left the "name" parameter in the function call, but it won't be used. I made this to let the calling be more close that what you have now.
When you try to open a popup and another window(popup) have the same "name", the already opened window have it's location updated to the new url.
This will have the effect of preventing that multiple sounds are played at the same time.
__________________
Only a biker knows why a dog sticks his head out the window.
|