HTML Encoder
Have you ever wanted to encode your html to make it show up inside of um say wordpress post and not be ran through html scripting? Well here yah go: This will output that for you!
(Allthough this will not work in IE) Working on a solution for that (try this)
Source Text :
With Entities Encoded: (Click to Select All)
Want this code?
If you just copy/paste code below to webpage it should work.
Javascript code with script tags to put in html code/webpage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <script type="text/javascript">
//<![CDATA[
function $(id){ return document.getElementById(id) }
function encode_entities(s){
var result = '';
for (var i = 0; i < s.length; i++){
var c = s.charAt(i);
result += {'<':'<', '>':'>', '&':'&', '\"':'"', '\'':''', '-':'-', '/':'/', '=':'=', '!':'!', '(':'(', ')':')', '[':'[', ']':']', '{':'{', '}':'}', '\n':' '}[c] || c;
}
return result;
}
function do_encode(e){
$('pre').innerHTML = $('dst').value = encode_entities(e.value)
}
//]]>
</script> |
<script type="text/javascript"></script> tags. You also have to add the forms portion of the code too.
note: Javascript code without script tags are to put in *.js file
Forms file/html
1 2 3 4 5 6 | Source Text : <div id="form"> <textarea cols="80" rows="16" onkeyup="do_encode(this)" onchange="do_encode(this)"></textarea> With Entities Encoded: (Click to Select All) <textarea id="dst" cols="80" rows="16" onfocus="this.select()" onclick="this.select()"></textarea> </div> |
Popularity: 1%
Related Posts
- Copy paste textbox First paste all code here in your front end: <script...
- C-Code Shift Cipher You need these following files to make it work: This...
- Top 15 wordpress 2.7.1 plugins There is a lot of "stuff" on my page and...
- FATAL ERROR MEMORY ISSUES Wordpress Ok So I needed to install a new version of...
- And The Winners Of The Liquid Bottles Are... Thanks to everyone who entered the giveaway for the two...
- How to: Setup and Create your own Signatures in your Email account Writing an e-mail is like writing a letter. A letter...
- Display Your iGoogle Gadget User Count Most of you probably won't use this ever, but if...
- Voice, Texting, Mobile Platform Ribbit Disclosure: I was paid as a consultant to produce the...


Firefox