开发者

JQuery error on javascript document null or undefined

I am recieving the following error when trying to execte the java script listed below in the page load event of an aspx web page.

Microsoft JScript runtime error: Unable to get value of the property 'document': object is null or 开发者_高级运维undefined

Dim scriptString As String = ("<script>javascript: window.opener.document.forms(0).submit(); </script>")
If Not Page.ClientScript.IsClientScriptBlockRegistered(scriptString) Then
    Page.ClientScript.RegisterClientScriptBlock(Me.[GetType](), "script", scriptString)
End If

I am trying to produce a postback.

Any help would be appreciated.


From MDN -

When a window is opened from another window, it maintains a reference to that first window as window.opener. If the current window has no opener, this method returns NULL.

Is it possible that the page your script is being called from has no opener? That would explain the document reference being null.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜