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);"
/>
</div>
</form>
</body>
</html>
Comments
Post a Comment
Thank You for your Comment