How can I get Frontpage to ad? (calculating)


G

Guest

I'm making a little page were I need the page to calculate. How can I do that?
 
Ad

Advertisements

M

Mark Fitzpatrick

FrontPage (and other similar programs) don't do this themselves. You need to
use JavaScript to do this. It's not too tricky, but does involve a bit of
work. You can start at javascript.internet.com and www.dynamicdrive.com to
look for similar scripts that could get you started.
 
Ad

Advertisements

T

Trevor Lawrence

tomas mathiassen said:
I'm making a little page were I need the page to calculate. How can I do
that?
Try this

<html>
<head>
<script type="text/javascript">
function calcform()
{
with (document.form1)
{ result.value = +number1.value + +number2.value}
/*Note the extra + operator before each value. This is needed to convert the
value from a string to a number.*/
}
</script>
</head>
<body>

Sum of Two Numbers
<form name="form1" action="">
Number 1:<br />
<input type="text" id="number1" value="" size="40" /><br/>
Number 2:<br />
<input type="text" id="number2" value="" size="40" /><br/>
Sum:<br />
<input type="text" id="result" value="" size="40" /><br/>

<input type="button" id="Calculate" value="Calculate"
onclick="calcform()" />
<input type="reset" id="reset" value=" Clear "/>
</form>

</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top