I've got a textarea that, with the click on a button, shows the html-look of the data in the textarea. This script I found on the net (with author source ).
Now I've added the option to make text in BOLD etc (code found on this forum), BUT it doesn't work....
This is the code (within a php file):
Expand|Select|Wrap|Line Numbers
- <div align="center">
- <table style="width:600px;border:solid 1px #959492;background:#ebebea">
- <tr><td valign="top">
- <form name="f" method="post">
- <textarea id="$key" name="$key" style="border:solid 1px #b9b8b6;padding:5px;width:300px;height:100px;scroll:auto;" $varwrap rows="$t_rows" cols="$t_cols" onkeyup=\"checktxtr("$key", $t_max, "dl$key");\" class=formst>".$fields_val[$key]."
- <a href="http://www.thenetter.com/scripts/" target="_new">More Free Scripts</a> dododod
- </textarea>
- <table onMouseover="changeto(event, "lightyellow")" onMouseout="changeback(event, "silver")"><tr><td><font face="trebuchet, arial, HELVETICA" COLOR="#000099" size="-2"><b>
- <div id="dl$key"></div></b></font></td><td><font face="trebuchet, arial, HELVETICA" COLOR="#000099" size="-2"><b>".$msg2["chars_left"]."</b></font></td></tr></table>
- <script language="javascript">checktxtr("$key", $t_max, "dl$key");</script>
- <BR>
- <button onclick="window.document.f.$key.value='<BR>';preview.document.write (document.getElementsByName ('$key')[0].value); preview.document.close(); preview.focus()">Nieuwe regel</button>
- <input type="button" name="Button" value="B" onclick="ChangeText(this.f.$key,);" /> <input type="button" name="Button" value="U" onclick="ChangeText(this.f.$key,;" />
- <input type="button" name="Button" value="LINE" onclick="ChangeText(this.f.$key,[HR SIZE=1] [/HR];" /> <input type="button" name="Button" value="SPACE" onclick="ChangeText(this.f.$key,<BR />;"/>
- </td><td valign="top">
- <iframe src="about:blank" name="preview" style="height:100px;width:300px;border:solid 1px #b9b8b6;background:#ffffff" frameborder="0">
- </iframe>
- </td>
- </tr>
- </table>
- <!-- getElementByTagName ('TEXTAREA')[0].value); -->
- <button onclick="preview.document.write (document.getElementsByName ('$key')[0].value); preview.document.close(); preview.focus()">Voorbeschouwing</button>
- <button onclick="window.document.f.$key.value='';preview.document.write (document.getElementsByName ('$key')[0].value); preview.document.close(); preview.focus()">Clear All</button>
- <button onclick="window.location.href=window.location.href">Ververs</button>
- </div>
- </form>