I2izzo
03-16-2012, 08:56 PM
currently working on a project and I cant figure the right coding to get my results to pop up in a new page, same window AND an alert box. I got the alert box part down perfectly but cannot figure out how to get my results. Even if i can figure out how to get them on the same page in their designated field, I can probably figure the rest out, the coding i have so far looks like this: ( i cant figure out how to make it look cool in a diff. window... sorry)
<HTML>
<HEAD>
<b>
Here is a pay slip generator that will determine your net annual salary.
<br>
Simply type in your first and last name along with gross salary and hit calculate.
<br>
Doing this will let you know how much you will end up paying in both Federal and State taxes.
</b>
<form action="" method="post">
<p> Enter your First Name:
<input name="num1" type="text" id="num1" size="10" maxlength="10">
</p>
<p> Enter your Last Name:
<input name="num2" type="text" id="num2" size="10" maxlength="10">
</p>
<p> Enter your gross salary:
<input name="num3" type="#" id="num3" size="10" maxlength="10">
</p>
Click this button to calulate your annual net pay!
<script type="text/javascript">
function calculate()
{
var fName = document.getElementById('num1').value;
var lname = document.getElementById('num2').value;
var sal = Number(document.getElementById('num3').value);
alert('Hello '+ fName + ' '+ lname + ', you would pay $'+ sal * .2 + ' in Federal taxes and $'+ sal * .1 + ' in State taxes, leaving you $'+ sal * .7 + ' to take home annually!'); //for testing
}
</script>
<input type="button" onclick="calculate()" value="Generate Pay Slip" />
<input type="button" value="Reset Form" onClick="this.form.reset()" />
<p>Total federal taxes:
<input name="num4" type="#" id="num4" size="10" maxlength="10" value= N/A>
</p>
<p>Total State taxes:
<input name="num5" type="#" id="num5" size="10" maxlength="10" value= N/A>
</p>
<p>Net annual salary:
<input name="num6" type="#" id="num6" size="10" maxlength="10" value= N/A>
<script type="text/javascript">
function show_results
{
var ftax = document.getElementbyId('num4').value;
var stax = document.getElementbyId('num5').value;
var npay = document.getElementbyId('num6').value;
}
</TEXTAREA>
</FORM>
</body>
</html>
</script>
Any clues would be very helpful
<HTML>
<HEAD>
<b>
Here is a pay slip generator that will determine your net annual salary.
<br>
Simply type in your first and last name along with gross salary and hit calculate.
<br>
Doing this will let you know how much you will end up paying in both Federal and State taxes.
</b>
<form action="" method="post">
<p> Enter your First Name:
<input name="num1" type="text" id="num1" size="10" maxlength="10">
</p>
<p> Enter your Last Name:
<input name="num2" type="text" id="num2" size="10" maxlength="10">
</p>
<p> Enter your gross salary:
<input name="num3" type="#" id="num3" size="10" maxlength="10">
</p>
Click this button to calulate your annual net pay!
<script type="text/javascript">
function calculate()
{
var fName = document.getElementById('num1').value;
var lname = document.getElementById('num2').value;
var sal = Number(document.getElementById('num3').value);
alert('Hello '+ fName + ' '+ lname + ', you would pay $'+ sal * .2 + ' in Federal taxes and $'+ sal * .1 + ' in State taxes, leaving you $'+ sal * .7 + ' to take home annually!'); //for testing
}
</script>
<input type="button" onclick="calculate()" value="Generate Pay Slip" />
<input type="button" value="Reset Form" onClick="this.form.reset()" />
<p>Total federal taxes:
<input name="num4" type="#" id="num4" size="10" maxlength="10" value= N/A>
</p>
<p>Total State taxes:
<input name="num5" type="#" id="num5" size="10" maxlength="10" value= N/A>
</p>
<p>Net annual salary:
<input name="num6" type="#" id="num6" size="10" maxlength="10" value= N/A>
<script type="text/javascript">
function show_results
{
var ftax = document.getElementbyId('num4').value;
var stax = document.getElementbyId('num5').value;
var npay = document.getElementbyId('num6').value;
}
</TEXTAREA>
</FORM>
</body>
</html>
</script>
Any clues would be very helpful