Superscript In Asp.Net Textbox without using Richtextbox


Instead of Use mc⁴ Code to mc<sp>4</sp>.




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Js/jquery.min.js" type="text/javascript"></script>

     <script type="text/javascript">
         $.fn.superScript = function () {
             var chars = '+−=()0123456789AaÆᴂɐɑɒBbcɕDdðEeƎəɛɜɜfGgɡɣhHɦIiɪɨᵻɩjJʝɟKklLʟᶅɭMmɱNnɴɲɳŋOoɔᴖᴗɵȢPpɸrRɹɻʁsʂʃTtƫUuᴜᴝʉɥɯɰʊvVʋʌwWxyzʐʑʒꝯᴥβγδθφχнʕⵡ',
        sup = '⁺⁻⁼⁽⁾⁰¹²³⁴⁵⁶⁷⁸⁹ᴬᵃᴭᵆᵄᵅᶛᴮᵇᶜᶝᴰᵈᶞᴱᵉᴲᵊᵋᶟᵌᶠᴳᵍᶢˠʰᴴʱᴵⁱᶦᶤᶧᶥʲᴶᶨᶡᴷᵏˡᴸᶫᶪᶩᴹᵐᶬᴺⁿᶰᶮᶯᵑᴼᵒᵓᵔᵕᶱᴽᴾᵖᶲʳᴿʴʵʶˢᶳᶴᵀᵗᶵᵁᵘᶸᵙᶶᶣᵚᶭᶷᵛᶹᶺʷᵂˣʸᶻᶼᶽᶾꝰᵜᵝᵞᵟᶿᵠᵡᵸˤⵯ';
             //                /<sup[^>]*>(.*?)<\/sup>/g
             return this.each(function () {

                 this.value = this.value.replace(/<sp[^>]*>(.*?)<\/sp>/g, function (x) {
                     var str = '',
                txt = $.trim($(x).unwrap().text());

                     for (var i = 0; i < txt.length; i++) {
                         var n = chars.indexOf(txt[i]);
                         str += (n != -1 ? sup[n] : txt[i]);
                     }
                     return str;
                 });
             });
         }

       

         function hello($this) {
             $($this).superScript();
         }
       
        </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
    <input type="text" id="txtUnt" value="" maxlength="10" onblur="hello(this);"  />&nbsp;
    </div>
    </form>
</body>
</html>



Comments

Popular posts from this blog

Unable to perform operation on the item is locked in workspace

Maximum Stored Procedure Function Trigger or View Nesting Level Exceeded (limit 32) in SQL Server

Insecure cookie setting: missing Secure flag