Today is . Page created 04/08/06, Updated 01/31/07

HTML Code Box Editor Tester

A code box where users can edit code and preview their results all on the same page. A great way to offer your code snippets to your visitors.

W e have tested the code in IE7.0, IE6.0, Firefox1.5.0.1, Opera8.52, Netscape7.02, Netscape8.0.4 and AOL Explorer1.2. This script worked well in all platforms with no variations observed.

D epending on your knowledge of HTML and javascripts, this is an easy one (1) part copy and paste code that goes anywhere in the <BODY> section you want it to appear. For all intensive purposes, there are "No" reconfigurations other than for cosmetic reasons to blend more into your site.

<div align="center">
<table style="width:600px;border:solid 1px #959492;background:#ebebea">
<tr><td valign="top">
<form name="form1" method="post">
<textarea name="code" wrap="soft" onclick="focus(this.code)" style="border:solid 1px #b9b8b6;padding:5px;width:300px;height:300px;scroll:auto;">

This is where the code(s) will go

</textarea>
</form>
</td><td valign="top">
<iframe src="about:blank" name="preview" style="height:300px;width:300px;border:solid 1px #b9b8b6;background:#ffffff" frameborder="0">
</iframe>
</td>
</tr>
</table>

<!------Start Buttons ------>

<button onclick="preview.document.write (document.getElementsByTagName ('TEXTAREA')
[0].value); preview.document.close(); preview.focus()">Generate Preview</button>
<button onclick="window.document.form1.code.value='';preview.document.write
(document.getElementsByTagName ('TEXTAREA')[0].value); preview.document.close();
preview.focus()">Clear All</button>
<button onclick="window.location.href=window.location.href">Reload</button>

<!------End Buttons ------>

For Your Information For your Information:     As you can notice in the above code, we have the button section sectioned off from start to end. Reason being is quite simple. The default has the buttons as shown at the bottom of the effect. If you want the buttons on top of the effect, just cut and paste the above section as shown below at the top of the code instead of at the bottom of the code.
                                       

<div align="center">

<!------Start Buttons ------>

<button onclick="preview.document.write (document.getElementsByTagName ('TEXTAREA')
[0].value); preview.document.close(); preview.focus()">Generate Preview</button>
<button onclick="window.document.form1.code.value='';preview.document.write
(document.getElementsByTagName ('TEXTAREA')[0].value); preview.document.close();
preview.focus()">Clear All</button>
<button onclick="window.location.href=window.location.href">Reload</button>

<!------End Buttons ------>

<table style="width:600px;border:solid 3px #ba55dc;background:#ffffff">
<tr><td valign="top">
<form name="form1" method="post">

W e hope our tutorial was easy to follow and we covered everything in detail. If you would like to add this effect into your pages, grab the respective below link and you are there. If you have any problems with this or anything else, feel free to consult our FAQ ] and if you can't find the answer there, contact us ].
Get Code Here ]   [ Rate This Page ]