Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

new, and struggling

Status
Not open for further replies.

malagash

Technical User
Aug 29, 2006
252
CA
As the title says I'm having a time getting started in javascript.

I want to do something simple. I have two text boxes and want to calculate the value of the two entries with a function but I just can't grasp the concept of extracting values from two text boxes.
Any help will be appreciated.

Enter this week's total hours <input name="hours" type="text"><br />
Enter the hourly rate of pay <input name="rate" type="text"><br />
<input name="submit" type="button" value="Calculate Gross Pay" onClick="calcPay(form..hours.value)">
</form>
<script type="text/javascript">
function calcPay (total) {
document.write (total);
}
</script>
 
Hi malagash, is this for a homework assignment? It's pretty novice javascript stuff is why I ask. Have you tried searching google for any javascript tutorials to get you started out?

-kaht

Looking for a puppy?

silky-icon-left.gif
[small]Silky Terriers are small, relatively odorless dogs that shed no fur and make great indoor pets.[/small]
silky-icon-right.gif
 
I'm working through a tutorial and attempting an exercise. I'm learning that I am pretty slow on the uptake...
 
Well, I think "form..hours.value" is part of your answer (except the double periods). The other part is that you need to multiple the hourse by the value. You also need to display the value in a dialog, not write it, unless you expect your users to have the JScript console open!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top