...

View Full Version : How to write on the same page?



timothymarvel
09-09-2008, 08:24 PM
Hi, I wanted to now the method for how to write a value in on a same page without losing all the rest of the page. IN the cas of my script it should bee in the "r" box.

{code}
<html>
<head>

<title>Calcul de force électrique </title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function Calculator(){

var a=document.calculator.a.value;

var b=document.calculator.b.value;

var aq=b*b;

document.write(aq) ON THE SAME PAGE IN "R" BOX??

}
// End -->
</SCRIPT>



</head>
<body>
<div id="main">
<form name=calculator>

<br><br>±
<input name="a">
<input name="b">




<br><br><br>
<input name="r"> result

<input type="button" value="Go!" onClick="Calculator()">

</form>
</body>
</html>
{/code}



Thanks for your help.

Mr J
09-09-2008, 10:30 PM
Replace

document.write(aq)

with

document.calculator.r.value=aq



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum