Displaying square root in HTML

I know there is a root √ symbol/radical, ASCII code is & # 8730; (minus the spaces)

But according to…

http://www.lanwrights.com/books/htm...h4d2e/t0076.htm

…there are dedicated HTML commands to display root signs:

<SRQT> or <ROOT>

but these don’t work, have these tags been removed since HTML3?
(If so is there any other way I can do the same thing)

Thanks all

Salvo

well salvo … i dont know about such an HTML tag but if u desperately need it … try this JavaScript function –

in the following code - ‘x’ is the no of which u want the sqrt.

<script language="JavaScript">
var num=Math.sqrt(x);
document.write(num);
</script>

Thanks Ruchir

Your code does work but I’m actually looking for a way to display the root sign, rather than calculate it, which I’ve already done by using x^(1/2).

Any more ideas would be grealty appreciated.

Salvo

Firstly please keep your questions in the same thread rather than starting a new one like you have here.

Secondly, √ will display a square root symbol, but I am not sure of browser compatibilty, but it works in IE6.

Glen :slight_smile:

EDIT:

Heh, well to prove it, it shows up in the thread so here it is in code tags:


&#8730;

Grrrrr, even code tags do not work so its & # 8 7 3 0 ; without the spaces!

Sorry about starting a second thread, but I thought it’s more appropriate in this, the HTML sub-forum, plus it’s urgent. Sorry.

While & # 8730; does render the radical, it does not provide the vinculum that clarifies the scope of the operation (ie. go over the entire expression - which I need it to do). I’m pretty sure it’s compatable with all browsers since its ASCII and was listed under the w3 guide.

Salvo

Although by no means a perfect solution you could try the following;


<html>
<head>
<title>Square Root</title>
</head>

<body>
You could use an inline table
<table style="display:inline;" width="72" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="14" height="9">&nbsp;</td>
    <td width="58" align="left" valign="bottom" height="9"><font face="Symbol"><strong>______</strong></font></td>
  </tr>
  <tr>
    <td width="14" valign="top" align="right"><font face="Symbol" size="+2">&#214;</font></td>
    <td width="58">(<em>x</em>-1)+<em>y</em></td>
  </tr>
</table>
like this
<p>or</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="508" valign="middle">
      <div align="right">you could use nested tables &nbsp;</div>
    </td>
    <td width="65">
      <table style="display:inline;" width="68" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="14" height="9">&nbsp;</td>
          <td width="54" align="left" valign="bottom" height="9"><font face="Symbol"><strong>______</strong></font></td>
        </tr>
        <tr>
          <td width="14" valign="top" align="right"><font face="Symbol" size="+2">&#214;</font></td>
          <td width="54">(<em>x</em>-1)+<em>y</em></td>
        </tr>
      </table>
    </td>
    <td width="558" valign="middle">&nbsp; like this</td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>

There’s an entity for the square root symbol:
& radic ; (without the spaces) - √

–Viral

try this:

<p>&radic;<span style="border-top: 1px solid #000000; font-size: 14px;">7563443</span></p>

You may have to adjust the font-size of the span to get it to appear right, based on what font you use and what browser you’re building for. It’s far from a perfect method, but it would accomplish what you are trying to do.

Sketch

Thanks Sketch

That’s a neat solution, very innovative.

I will share it with others at mathsforum (who have the same problem)

Salvo

I think what you really need for this kind of thing is MathML, but Sketch’s workaround is pretty neat.