I am trying to create fractions in an editbox, or textbox using javascript, such as 5/9
In other words, if I could create a temp string of the fraction format of “5/9”, the code would be:
editbox.value=temp;
I am aware that the html code would be:
<sup>5</sup>⁄<sup>9</sup>
I am also aware that the javascript way of changing to a superscript is to use .sup
The Unicode for a fraction slash is "\u2044"
However, if I use the following code:
var temp1 = "5" ;
temp1=temp1.sup();
var temp2 = "9" ;
temp2=temp2.sup();
temp="\u2044";
temp=temp1+temp+temp2;
player.value=temp;
It just gives :" sup>5 /sup>⁄ sup>9 /sup> "
Furthermore, although there are unicodes for superscripts of single digit numbers, there are no unicodes for subscripts, so the result is unreadable as a fraction.
Can anyone help?