在 Onload 事件上使用 Javascript 操作

Using Javascript Action on Onload event

我是 javascript 的新手,无法将我的代码更改为我想要的。

<iframe name="hidden_iframe" id="hidden_iframe"
style="display:none;" onload="if(submitted)
{window.location='http://site.html';}"></iframe>

我的意图是使用此 window.location(重定向到其他页面)在同一页面中启动一个操作。如果它是 link,我的代码将是:

<a onClick="OpenSel(1)"></a>

如何在 onload 事件后使用 OpenSel(1)?

谢谢!!

在已有内容后粘贴它:

onload="if (submitted) {window.location='http://site.html';} OpenSel(1)"

尽管如果将所有这些都放在一个函数中可能会更容易:

function loadCheck() {
    if (submitted) {
        window.location='http://site.html';
    } 
    OpenSel(1)
}

onload="loadCheck()"