Joshua Joshua - 9 months ago 25
HTML Question

How do you make a box that can test code?

Today I was wondering how to make a box that I can test code with using some JavaScript and HTML. Example: Click Here. Here's what I want it to do: You enter code into the text box, then you click the "Test HTML Code" button and it opens in a new tab with the code that you type into the text box. I hope this is enough information.


When you create a new window using open, it returns a reference to the new window, you can use that reference to write to the newly opened window via its document object.

Here is an example:

var newWin = open('url','windowName','height=300,width=300');
newWin.document.write('html to write...');