Click to See Complete Forum and Search --> : square root in HTML editor
venkat
10-01-2003, 01:26 AM
I need to have a dynamic square root in the HTML editor. With this the user should be able to type in values ( like fractions, text, numbers etc.) in the square root.
Can any one of you help me in this
Gollum
10-01-2003, 03:05 AM
The description is a little vague.
Do you mean something like this?
<html>
<body>
<input type=text onkeyup="document.getElementById('sqOut').innerHTML = Math.sqrt(parseInt(this.value));">
<span id="sqOut"></span>
</body>
</html>
sciguyryan
10-01-2003, 11:08 AM
i dont know if he needs it but, thanks yiou saved me asking the question for just this i owe you one!
neil9999
10-01-2003, 11:12 AM
Strange - i was going to ask for that code aswell!
sciguyryan
10-01-2003, 01:43 PM
cool!
neil9999
10-02-2003, 03:24 PM
Is it possible to find the cube root?
Thanks,
Neil
<html>
<body>
<input type=text onkeyup="document.getElementById('qrOut').innerHTML = Math.pow(parseInt(this.value),(1/3));">
<span id="qrOut"></span>
</body>
</html>
neil9999
10-02-2003, 04:17 PM
That doesn't seem to work - I type in 9 and it gives me 2.080083823051904! Any ideas why it doesn't work?
Note: I changed document.getElementById('qrOut').innerHTML to document.getElementById('sqOut').innerHTML
Thanks,
Neil
neil9999
10-02-2003, 04:20 PM
Whoops, i'm going mad. I was thinking of square root rather than cube root!
Neil