js代码|Javascript写入Html(js 写入html)
时间:2021-07-20 14:43:54 阅读:942
一:打开新的窗口,并向其中写入html代码
1 2 3 4 | var doc = window.open().document; doc.write("<html><head><title>向新打开的窗口添加html代码--newmin--www.atnet.cc</title></head><body><a href='javascript:window.openner=null;window.close()'>关闭</a><br />"); doc.write('Zshao网络 www.zshao.vip'); doc.write("</body></html>"); |
二:向Iframe中写入html代码
1 2 3 4 5 | <iframe name="_iframe" src="about:blank" frameborder="0"></iframe><script type="text/javascript">var ifr=window.frames["_iframe"];//注意这里_iframe是name属性ifr.document.write("<html><body>www.zshao.vip</body></html>");</script> |
三:将表单提交到iframe
1 2 3 4 | <iframe src="http://www.zshao.vip" style="display:none" name="_iframe"></iframe><form action="" method="post" target="_iframe"> <input type="submit" value="提交到iframe"></input></form> |
转自:https://www.cnblogs.com/newmin/archive/2010/10/26/1861291.html


网友评论