Mark Forums Read
  #1  
Old 02-13-2010, 05:44 PM
JavaScriptBank JavaScriptBank is offline
Senior Member
 
Join Date: Sep 2009
Posts: 130
JavaScriptBank is on a distinguished road
Default HTML to Entities script

This JavaScript converts special HTML characters to their entities version inside user entered data such as a TEXTAREA before the detail at JavaScriptBank.com - 2.000+ free JavaScript codes


How to setup

Step 1: Use JavaScript code below to setup the script
JavaScript
Code:
<SCRIPT type=text/javascript> // HTML to Entities (form) script- By JavaScriptKit.com (http://www.javascriptkit.com) // For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/ // This notice must stay intact for use function html2entities(){ var re=/[(<>"'&]/g for (i=0; i<arguments.length; i++) arguments[i].value=arguments[i].value.replace(re, function(m){return replacechar(m)}) } function replacechar(match){ if (match=="<") return "&lt;" else if (match==">") return "&gt;" else if (match=="\"") return "&quot;" else if (match=="'") return "'" else if (match=="&") return "&amp;" } </SCRIPT> <!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com -->
Step 2: Copy & Paste HTML code below in your BODY section
HTML
Code:
<FORM><TEXTAREA style="WIDTH: 400px; HEIGHT: 100px" name=data1></TEXTAREA><BR> <INPUT onclick=html2entities(this.form.data1) type=button value="Convert special chars to entities"> </FORM> <!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com -->





Reply With Quote
 #Add to Ads's Reputation  
OldSponsored Ads
Ads AdsPromoter is online
Member
 
Join Date: LongTime
Posts: 1100
Ads is on a distinguished road
Default New Sponsored Ads



This message will go away once you are registered. Also, by registering, you will have access to all post topics, communicate privately with other members (PM), respond to polls, upload graphics, and access other special features! Registration is fast, simple and absolutely free so please Click Here to join our Web Hosting community today!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 06:29 PM.


Powered by vBulletin Version 3.6.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 2.4.0