Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.NET
<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>



the problem is that:

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

it does not see the iframe control
Posted
Updated 9-Oct-11 17:24pm
v5

1 solution

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

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





try this

<body onload="enablecontrols()">
 
Share this answer
 
v3
Comments
MrLonely_2 10-Oct-11 0:29am    
Thanks man, but it not help.
the same error still:
qwerty.document.body is null or not an object.
hitech_s 10-Oct-11 1:20am    
where you are calling that function?
hitech_s 10-Oct-11 1:21am    
do like this
<body önload="fnframe()">
MrLonely_2 10-Oct-11 3:34am    
i have no body man, my asp page has master page.
I call it above the end of content tag
hitech_s 11-Oct-11 7:54am    
ok
then call this function in page load

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900