Time:09-16
CodePudding user response:
you might have any misunderstanding for JavaScript
& lt; ! DOCTYPE html> <meta charset="utf-8"/& gt; TestJs <style type="text/CSS" & gt; The button {Width: 120 px; height: 30px; Margin - bottom: 8 px; } Div {Width: 820 px; Height: 400 px; } Textarea {Width: 400 px; Height: 400 px; float: left; Margin - right: 6 px; } The iframe {Width: 400 px; Height: 400 px; float: left; } </style> Var HTML=` & lt; ! DOCTYPE html> <meta charset="utf-8"/& gt; TestJs <body> According to the time & lt;/button> `; Window. The onl oad=function () {Var txtHtml=document. GetElementById (' txtHtml '); txtHtml.value=https://bbs.csdn.net/topics/html; BtnOK_click (); } The function btnOK_click () {Var iframe1=document. GetElementById (' iframe1 '); Var txtHtml=document. GetElementById (' txtHtml '); Var. Doc=iframe1 contentWindow. Document; Doc. The open (); Doc. Write (txtHtml. Value); Doc. The close (); } </script> <body> Run the code & lt;/button> <iframe1 iframe id="" SRC=" https://bbs.csdn.net/topics/about:blank "& gt; </iframe>