Home > front end > The code compilation functions of this site is how to implement?
The code compilation functions of this site is how to implement?
Time:10-05
The great god, I came across a technical problem, this site's online code compilation function is how to do? Turn to the great god!
CodePudding user response:
Code is not for you last time, how to still ask?
& lt; ! Doctype html> & lt; HTML lang="en" & gt; & lt; head> & lt; Meta charset="utf-8"/& gt; & lt; Meta name="viewport" content="width=device - width, initial - scale=1.0" & gt; & lt; Meta HTTP - equiv="X - UA - Compatible" content="IE=edge, chrome=1"/& gt; & lt; title> The name of the page & lt;/title> & lt;/head> & lt; body> & lt; Input type="button" value="https://bbs.csdn.net/topics/run code" onclick="the run ();"/> & lt; Br/& gt; & lt; Textarea id="text" rows="50" cols="80" & gt; & lt; ! DOCTYPE html> & lt; html> & lt; body>
& lt; The h2 & gt; My first paragraph JavaScript & lt; The button type="button" Onclick="document. The getElementById (' demo '). InnerHTML=the Date ()" & gt; Click here to display the date and time & lt;/button>
& lt; P id="demo" & gt; & lt;/p>
& lt;/body> & lt;/html> & lt;/textarea> & lt; Iframe SRC="https://bbs.csdn.net/topics/about:blank" width="800" height="750" id="ifr" & gt; & lt;/iframe> & lt; The script type="text/javascript" & gt; The function the run () { Var STR=document. GetElementById (" text "). The value; Var ifr=document. GetElementById (" ifr "); Ifr. SRC="https://bbs.csdn.net/topics/about:blank"; Var ifd=ifr. ContentDocument; Ifd. The open (); Ifd. Write (STR); Ifd. Close (); } run(); & lt;/script> & lt;/body> & lt;/html>