Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
171
rated 0 times [  177] [ 6]  / answers: 1 / hits: 41517  / 12 Years ago, thu, november 29, 2012, 12:00:00

I know this is an extremely basic question, but I just couldn't find anything useful on the internet. I have 2 input boxes and I want calculate that input and put the result in output using submit button and navigating by form id.



<script>
function Calculate()
{

var resources = GetFieldValue( Resources );
var minutes = GetFieldValue( Minutes );
var permin = parseFloat(resources) / 60;
var result = parseFloat(permin) * parseFloat(minutes);
</script>

More From » forms

 Answers
12
<body>
<input type='text' id='Resources'/>
<input type='text' id='Minutes' onblur='Calculate();'/>
<form name =testarea Method=Get Action=youpage.html id='form1'>
<input type='text' id='answer' name='ans' />
</form>
</body>
<script>


function Calculate()
{
var resources = document.getElementById('Resources').value;
var minutes = document.getElementById('Minutes').value;
var permin = parseFloat(resources) / 60;
document.getElementById('answer').value=parseFloat(permin) * parseFloat(minutes);
document.form1.submit();
}
</script>


Your form will submit and your answer is in the url like



youpage.html?ans=youranswer

[#81717] Wednesday, November 28, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
myrap

Total Points: 407
Total Questions: 105
Total Answers: 109

Location: Cambodia
Member since Thu, Oct 7, 2021
3 Years ago
myrap questions
Tue, Feb 8, 22, 00:00, 2 Years ago
Wed, Jan 15, 20, 00:00, 4 Years ago
Thu, Oct 24, 19, 00:00, 5 Years ago
Thu, Oct 3, 19, 00:00, 5 Years ago
Mon, Aug 12, 19, 00:00, 5 Years ago
;