search

Home  >  Q&A  >  body text

html5 - How to implement this code display function?

I want to know how to create such a web page with html js on the left and display on the right?
What is its principle?

I downloaded wp fiddle and found that it cannot be used in my latest version of wordpress. I want to implement it myself.

When submitting the code, a submitTryit() function is triggered. This function is very simple

function submitTryit()
{
var t=document.getElementById("TestCode").value;
t=t.replace(/=/gi,"w3equalsign");
t=t.replace(/script/gi,"w3scrw3ipttag");
document.getElementById("code").value=t;
document.getElementById("tryitform").action="v.asp";
validateForm();
document.getElementById("tryitform").submit();
}
function validateForm()
{
var code=document.getElementById("code").value;
if (code.length>5000)
    {
    document.getElementById("code").value="<h1>Error</h1>";
    }
}
淡淡烟草味淡淡烟草味2763 days ago954

reply all(3)I'll reply

  • 世界只因有你

    世界只因有你2017-06-21 10:14:03

    On the left is a form. When writing code, the right side is iframe, and the target of the code form on the left is set to the right iframe just

    reply
    0
  • 为情所困

    为情所困2017-06-21 10:14:03

    This page uses iframe, see the picture below

    reply
    0
  • ringa_lee

    ringa_lee2017-06-21 10:14:03

    The left p#contenteditable, the right p.html(contenteditable.html())won’t work?

    reply
    0
  • Cancelreply