The following code will display several "tumbnails", where each one has a button labeled "tracklist". But it happens, for example, if I click on one of the buttons and it does not close its window, all other tracklist buttons that are clicked or activated will "write" in the first opened window ...
<head>
<script type="text/javascript">
function myFunction(content) {
var playlist = content;
var x = parseInt((screen.width-800)/2);
var y = parseInt((screen.height-600)/2);
var win = window.open( '', 'pop', 'scrollbars=1,statusbar=1,menubar=0,resizable=1,width=800,height=600' );
win.document.write ('Playlist:' + playlist);
win.moveTo(x,y);
}
</script>
</head>
PHP
foreach($rows as $row){
echo "<div class='tumbnail'>";
echo "<img src='imagem.jpg'>";
echo "<input class=\"btn_tracklist\" type=\"button\" value=\"Tracklist\" onclick=\"javascript:myFunction('" . $row['tracklist'] . "')\"> </br>";
echo "</div>";
} /*END Foreach*/