0

我正在尝试从 Oracle ApeX 的 Stack Overflow 中的该线程运行此代码,看起来 setTimeout 调用似乎无法正常工作:

[see thread][1]

<html lang="en">
<head>
<title>Dashboard Example</title>
<style type="text/css">
body, html { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
iframe { border: none; }
</style>
<script type="text/javascript">
var Dash = {
    nextIndex: 0,

    dashboards: [
        {url: "http://www.google.com", time: 5},
        {url: "http://www.yahoo.com", time: 10},
        {url: "http://www.stackoverflow.com", time: 15}
    ],

    display: function()
    {
        var dashboard = Dash.dashboards[Dash.nextIndex];
        frames["displayArea"].location.href = dashboard.url;
        Dash.nextIndex = (Dash.nextIndex + 1) % Dash.dashboards.length;
        setTimeout(Dash.display, dashboard.time * 1000);
    }
};

window.onload = Dash.display;
</script>
</head>
<body>
<iframe name="displayArea" width="100%" height="100%"></iframe>
</body>
</html>

如何让这个调用在 Oracle ApEx v3.0.1 中工作?

4

1 回答 1

0

这个问题与 Apex 无关 - 事实上,您可以获取您发布的 HTML,将其保存到文件中,然后在浏览器中运行该文件以对其进行测试。

不幸的是,www.google.com 是一个不适用于此代码的 URL,因为它包含自己的一些“framebusting”Javascript,会将其从框架中弹出到浏览器窗口中,之后您的代码将不再运行。stackoverflow.com 做了类似的事情。例如,如果您将第一个 URL 更改为 www.bbc.com,那么它会工作(无论如何在 IE 上),直到它到达 stakoverflow.com,然后它会从框架中弹出。

于 2010-06-29T14:48:51.463 回答