带有数据库参数的Javascript弹出窗口

时间:2014-02-03 23:09:46

标签: javascript php database popup window

我试着长时间做一个javascript window.open函数并从数据库中读取参数。我需要链接,id,宽度,高度和位置。这是我的代码:

<html>
<head>

<?php

 mysql_connect('localhost','root','');
   mysql_select_db("popup");

   $res = mysql_query("select * from place");
   $num = mysql_num_rows($res);
?>

<script type="text/javascript">

<?php while ($dsatz = mysql_fetch_assoc($res)){ ?>

var urls=<?php $dsatz["web"]; ?>;

<?php } ?>

function popups_oeffnen(){

var urls_anz=<?php echo $num; ?>;
for (i=0;i<urls_anz;i++){
if (urls[i]!=""){
window.open(urls[i],'PopUp_' + i,'width=400,height=400');
}
}
}
</script>
</head>
<body>

<input type="button" onclick="return popups_oeffnen();" value="Öffnen" />

</body>
</html>

我什么也没得到,为什么?

0 个答案:

没有答案