document.body为null或不是对象 [英] document.body is null or not an object

查看:170
本文介绍了document.body为null或不是对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想在asp.net页面的加载时为iframe innerHTML属性分配一个值

asp.net页面具有MasterPage,

那是我的尝试:

Hi every body,

I want to assign a value to iframe innerHTML property on the load of the asp.net page

The asp.net page has MasterPage,

that is my try:

<asp:Content ID="Content1" ContentPlaceHolderID="OperatorContent" Runat="Server">
<iframe id="qwerty" >
                        
</iframe>
<asp:hiddenfield id="hdhiddenfield" runat="server" />
<script type="text/javascript" >

var wer = document.getElementById('<%=hdhiddenfield.ClientID %>').value;
qwerty.document.body.innerHTML = qwe;

</script>
</asp:Content>




问题是:

qwerty.document.body为null或不是对象.

它看不到iframe控件




the problem is that:

qwerty.document.body is null or not an object.

it does not see the iframe control

推荐答案

尝试这样
将上面的脚本放在这样的一个函数中,然后调用该函数

try like this
put the above script in one function like this and call that function

<script type="text/javascript" >
function fnframe()
{
var wer = document.getElementById('<%=hdhiddenfield.ClientID %>').value;
qwerty.document.body.innerHTML = qwe;
}
</script>






试试这个






try this

<body onload="enablecontrols()">


这篇关于document.body为null或不是对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆