1

Hi my problem is as follows: I have a popup window opening on pageload with a music player. The problem is that the popup window opens every time i load the page. Also users are supposed to be able to choose if they want the music player to open the next time they visit the page. (Its on the homepage)

<html>
<head>
<title>
testpage music player
</title>
<SCRIPT LANGUAGE="JavaScript">
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=200,height=250,top=690,left=390');");
}
</script>
</head>
<BODY onLoad="javascript:popUp('http://www.ccc-clan.com/board/popupex.html')">
</body>
</html>
4

2 回答 2

2

给你的窗口一个名字

在打开之前,检查是否存在具有名称的元素...

http://tech.chitgoks.com/2009/09/11/javascript-check-if-popup-window-exists-using-its-window-name/

于 2010-12-18T13:53:25.993 回答
1

评估 = 坏

window["page" + id] = window.open(...)

问题是这些变量被破坏并且没有用。唯一的方法是设置一个窗口打开的会话cookie。当弹出窗口关闭时,销毁 cookie。

但为什么是音乐?所以1990年代

于 2010-12-18T13:55:48.477 回答