Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to open a Frame using javascript

i Mentioned Code Below.

please correct me if i am wrong.

JavaScript
<script type="text/javascript">
function showError(msg) 
{
     alert(msg);
     document.getElementByID('frm2').src=msg;

}
 
 
  </script>


this is Frame code

XML
this is my frame code
 <iframe  id ="frm2" width="1200" height="1000" style="left: -8px; width: 1140px; position: relative; top: 20px; height: 680px" language="javascript"  önblur="return frm2_onblur()"></iframe>


Posted
Updated 3-Oct-13 2:52am
v2
Comments
muneebalikiyani 3-Oct-13 6:22am    
If you want to open a window within an iframe:

Create the iframe with a name.

<iframe name="theFrame"></iframe>
Now use the script this way:

window.open(url, "theFrame");
hansoctantan 3-Oct-13 6:29am    
this is just a guess, how about innerHTML, if your tying to put some error message, why not use div
thatraja 3-Oct-13 6:29am    
You want to change URL of IFrame or what? your question is confusing little bit. Let us give you correct answer
Ashwani Gusain 3-Oct-13 7:27am    
this is my frame code
<iframe id ="frm2" width="1200" height="1000" style="left: -8px; width: 1140px; position: relative; top: 20px; height: 680px" language="javascript" önblur="return frm2_onblur()"></iframe>
Ashwani Gusain 3-Oct-13 7:31am    
I want paas values for frame from javascript dynamicaly

please suggest

1 solution

Go through this solution you will get idea
XML
<HTML>
<HEAD>
<TITLE> Title Goes here </TITLE>
<script type="text/javascript">
var flag2=0;
function func2()
{
flag2=1;
parent.frames['one'].location="1.html";
parent.frames['two'].location="3.html";
}
</script></HEAD>
<FRAMESET rows="115,*">
            <FRAME SRC="1.html" ID="one" name="one">

            <FRAME SRC="2.html" ID="two" name="two">

</FRAMESET>

</HTML>
Then, 1.html:

<HTML>
<HEAD>
<TITLE> Cow goes Moo </TITLE>
</HEAD>
<body>
 One.html
    <input onclick="parent.func2();" id="Button1" type="button" value="button" />
</body>

</HTML>
 
Share this answer
 

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