这些是相关行。javascript clearTimeout不是从子页面工作的
// In the parent page I set the timer and attach its handle to the window
window.warnTo = window.setTimeout("WarnTimeout();", 20000);
// If I clear the timer in the same page it works great
window.clearTimeout(window.warnTO);
// In the child page launched with window.open,
// I try to clear the timer and the timer still fires
window.opener.clearTimeout(window.opener.warnTO);
所有的变量似乎都被设置,而window.opener似乎是父窗口。 我很难过。
通常情况下,你不应该为'setTimeout'或'setInterval'使用字符串参数,尽管在这种情况下,它似乎没问题。 – 2012-02-02 14:08:10