IFRAME元素的相关js操作

1,在IFRAME网页内部获取该IFRAME的id:

1  var  frameId = frameElement.id;

 

2,动态创建IFRAME元素:

1  var  dvMain = parent.document.getElementById( " dvMain " );
2    var  newFrame = document.createElement( " IFRAME " );
3  newFrame.setAttribute( " id " , " id_new_frame " );
4  newFrame.setAttribute( " src " , " http://www.baidu.com " );
5  dvMain.appendChild(newFrame);

你可能感兴趣的:(iframe)