Js can create a frame dynamically?

59 2
<frameset rows="30,*" id="frame_body_content">
<frame name="tab" id="frame_tabs" scrolling="no" id="frame_tabs">
<frame name="tab_0" class="tab" id="tab_0"> 
</frameset>

If you want to add a <frame> between <frameset> </frameset>, js can do it.

1 Answers

64 5

Try to try jquery 's append method to insert, and it seems impossible, but the traditional method is tested on ie.
After jquery1. 7, you might want to take the rows property with the prop.

<html>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.2.min.js"></script>
<script type="text/javascript">
var j = jQuery.noConflict();
j(function(){
 var rows = j("#frame_body_content").attr("rows");
 j("#frame_body_content").attr("rows", rows +",200");
 var frame = document.createElement("frame");
 frame.src ="http://www.vogo.cc";
 j("#frame_body_content")[0].appendChild(frame);
});
</script>
<frameset rows="100,*" id="frame_body_content">
 <frame src="1.html"/>
 <frame src="2.html"/>
</frameset>
</html>
...