Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

I need to insert a textbox in a frame that is inserted into a frameset. The structure html and javascript is below:

HTML
<html>
<head>
<title>
</title>
<style type="text/css">
.holder{
    width: 100%;
    height:100%;
    position:relative;
}
.frame{
    width: 100%;
    height:100%;
}
.bar{
    position:absolute;
    top:150;
    left:150;
    width:50px;
    height:40px;
}
</style>

<script type="text/javascript">

    function addItem(xItem) {
       
       /* var ul = document.getElementById("content-area");
        var li = document.createElement("div");
        li.innerHTML = xItem;
        li.id = xItem;
        ul.appendChild(li);
        alert("fim"); */
        var ifrm = document.getElementById('te');
        ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
        ifrm.document.open();
        ifrm.document.write('Hello World!');
        ifrm.document.close();
    }


  
</script>  

<frameset id="fs" rows="100*" cols="*" frameborder="NO" border="0" framespacing="0" onload="teste();">
  <frame src="http://www.pplware.pt/" onload="addItem('teste');" id="te" >
<!--<frame style="position: relative;" src="http://www.sapo.pt/" name="frmMain" id="frmMain" frameborder="0" scrolling="Auto" noresize="noresize" marginwidth="0" marginheight="0">
--> <noframes><body><p>This page uses frames, but your stone-aged browser doesn't support them.</p></body></noframes>
 <input type="text" />
 

</frameset>


</head>
<body>
<script type="text/javascript">
    function checkFrameExistInPortalMain() {
        try {
            if (top.frames.length > 1) {
                window.parent.location.href = 'PortalMain.jsp';
            }
        } catch (err) {
        }
    }
    checkFrameExistInPortalMain();
</script>








</body>
</html>


What I want to do is insert a textbox in frame with the id = "te". I tried to create a function addItem to write Hello World site. MAs or it appears. Anyone have any idea how I can insert text in that frame? And how to insert a textbox?

Best Regards
Posted
Comments
Shubhashish_Mandal 9-Jul-13 7:42am    
Actually the content of frame loaded by the conten of given site(http://www.pplware.pt/). that is the reason you can't see anything. Put an alert message you will see the changes or remove the src="http://www.pplware.pt/" attribute.
Member 8901977 9-Jul-13 9:35am    
I already tried that. however I really need to create a textbox in the same frame. I think that with javascript, AppendChild, I will have a chance to do however do not know how should I proceed to create a textbox in an iframe with javascript

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