The program can convert characters, remove spaces in the middle of the characters, and click Bttton to copy the code. Further improvement is required. Please kindly advise. The left and right spaces functions are not completed.
Example:
<HTML> <HEAD> <TITLE> character handler </TITLE> </HEAD> <BODY bgColor = # bbccdd> <script language = "javascript" type = "text/javascript "> String. prototype. replaceAll = stringReplaceAll; function stringReplaceAll (AFindText, ARepText) {var raRegExp = new RegExp (AFindText. replace (/([\ (\) \ [\] \ {\} \ ^ \ $ \ + \-\*\? \. \ "\ '\ | \/\])/G," \ $1 ")," ig "); return this. replace (raRegExp, ARepText);} function myreplace () {var content = document. getElementById ("content "). value; var qa = document. getElementById ("tr "). value; var va = document. getElementById ("tp "). value; var rel_con = content. replaceAll (qa, va); while (rel_con.indexOf ("")! =-1) {rel_con = rel_con.replace ("", "");} document. getElementById ("content2 "). value = rel_con; // run the copy code var e = document. getElementById ("ct"); // The object is cte. select (); // select the object document.exe cCommand ("Copy"); // execute the browser Copy command} </SCRIPT> <HR color = red> <BR> <LI> remove space, escape Character <BR> <INPUT id = content value = "| a maxim | y World" name = contxt> <BR> <br> to be converted: <INPUT value = "|" id = tr name = contxt> <br> convert to a character: <INPUT id = tp value = "comment" name = contxt> <BR> <br> <textarea rows = "5" name = "ct" id = content2 cols = "50" style = "color: green ">... </textarea> <br> <INPUT onclick = myreplace () type = button value = "convert and copy this code"> <br> </BODY> </HTML> <br/> <center> If the effect cannot be displayed, press Ctrl + F5 to refresh the page. For more webpage code: <a href =' http://www.bkjia.com/ 'Target = '_ blank'> http://www.bkjia.com/ </A> </center>
Tip: the code can be modified before running!