


JS implements an example of HTML code preview function that can directly display the running effect of web page code_javascript skills
The example in this article describes the JS implementation of the HTML code preview function that can directly display the running effect of the web page code. Share it with everyone for your reference. The details are as follows:
JavaScript implements the HTML code preview function, which directly displays the effect of code running on the web page, such as the effect after clicking "Run Code". When using it, you only need to copy the HTML code that needs to be run into the text box and click Just click the corresponding function button.
The operation effect is as shown below:
The specific code is as follows:
<HTML> <HEAD> <TITLE>直接页面显示器</TITLE> <STYLE type="text/css"> BODY{MARGIN-TOP: 0px;FONT-SIZE: 9pt;MARGIN-LEFT: 4px;MARGIN-RIGHT: 0px;FONT-FAMILY: "微软雅黑"} A{FONT-WEIGHT: 400;FONT-SIZE: 13px;COLOR: black;TEXT-DECORATION: none} A: hover{FONT-WEIGHT: 400;FONT-SIZE: 13px;COLOR: red;TEXT-DECORATION: underline} A: active{CURSOR: hand;COLOR: #ff0033} .STYLE1{color: #0000FF;font-size: 40px;} .STYLE2{font-weight: bold;font-size: 30px;} </STYLE> <META http-equiv=Content-Type content="text/html; charset=gb2312"> </HEAD> <BODY> <CENTER> <span class="STYLE1"><FONT face=隶书>直接页面显示器</FONT></span> </CENTER><BR> <CENTER> <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 cellSpacing=0 cellPadding=0 border=0 borderlight="green"> <TBODY> <TR> <TD align=middle><span class="STYLE2"><FONT color=red>请在下面窗口中输入HTML代码</FONT></span></TD> </TR> <TR> <TD align=middle> <SCRIPT language=JavaScript> function trestart(){ if (script) { clear = confirm("确定要清除吗?",''); if(clear) { document.script.reset(); document.script.value = ""; } } } function test(){ { temp = document.script.tester.value; testwin= open("", "testwin","status=no,menubar=yes,toolbar=no"); testwin.document.open(); testwin.document.write(temp); testwin.document.close(); } } function about(){ alert("HTML代码直接显示出页面来") } function help(){ OpenWindow=window.open("", "newwin","height=220,width=470,toolbar=no,scrollbars="+scroll+",menubar=no"); OpenWindow.document.write("<body bgcolor='white' text='black' alink='blue'vlink='blue' link='blue'><TITLE>帮助信息</TITLE>") OpenWindow.document.write("<center>你只要把你想显示的代码放到上页的输入框中,你自己也可以写代码,按显示键就能显示你的页面内容</center><br>") OpenWindow.document.write("<center><a href='javascript:close()'>关闭本窗口</a></Center>") OpenWindow.document.close() self.name="main" } </SCRIPT> <FORM name=script><TEXTAREA name=tester rows=8 wrap=off cols=50></TEXTAREA> <BR><INPUT onclick=test() type=button value=显示> <INPUT onclick=trestart() type=button value=清除> <INPUT onclick=about() type=button value=关于> <INPUT onclick=help() type=button value=帮助> </FORM></TD></TR></TBODY></TABLE></CENTER> <CENTER> <DIV align=center> <CENTER> <TABLE id=AutoNumber1 style="BORDER-COLLAPSE: collapse" borderColor=#111111 cellSpacing=0 cellPadding=0 width=360 border=0> <TBODY> <TR> <TD> <P align=left><SPAN style="FONT-SIZE: 9pt">将下面代码复制到输入框试试<BR><FONT color=#ff0033><BR><html><BR><head><BR><title>你好</title><BR></head><BR><BR><body><BR> 你好,欢迎光临脚本之家网页特效栏目!<BR> </body><BR><BR></html></FONT></SPAN></P></TD></TR></TBODY></TABLE></CENTER></DIV> </BODY> </HTML>
I hope this article will be helpful to everyone’s JavaScript programming design.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
