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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mortgage, budget, and savings calculators

Status
Not open for further replies.

misslilbit02

Programmer
Jun 25, 2005
8
0
0
US
Hi,

I'm trying to code mortgage, savings, and budget calculators. What I'm trying to accomplish is once the submit button is pressed, it calls the specific function for the specific calculator in the .js file and then send the results to the results page. Now I'm not that java saavy so I have the following questions:


Once the submit button is pressed how do I direct the program to a particular function in the .js file (if that's possible)? And, if it is possible, can I use the form action or do I need to use onClick on the submit button to accomplish this?

How do I send the results of the calculations from the .js file to another html page?

Okay that's all you help will be greatly appreciated. Thank you.
Misslilbit02

 
Once the submit button is pressed how do I direct the program to a particular function in the .js file
By assigning an event handler to the button:
Code:
<input type=submit onclick="yourFunctionName()" />
How do I send the results of the calculations from the .js file to another html page?
Your best bet would be to get your calculation function to write the results to a hidden field on your form then submit the form.

Although it would be simpler and easier to display the results on the same page.

[sub]Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
[/sub]
 
Okay I get what you're saying. I have one more questions though. I'm using these flash buttons in Dreamweaver. Now I read tech note that said to put this bit of code, javascript: document.results.submit();, in the link box so that can behave like submit buttons. Now that you suggest I use onClick how do I modify that code?

Should I do something like this:
javascript: document.results.onClick="mort_pymts()"; or like this
javascript: document.results.submit onClick="mort_pymts()";

Confused please help.
 
I'm not a flash "programmer" by any stretch of the the imagination, but document.results.submit() would submit your form to it's target - which is what you want to do after you calculate your results.

Your best bet is to write a function that calculates your results and does whatever you need it to do - then call that function from your flash buttons.

[sub]Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top