Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Croatian

macrumors 6502
Original poster
Oct 14, 2006
260
0
Ontario, Canada
Here is my problem

i have a javascript that calculates values that are inputed in a form. For example, how much your food costs, so you put in lunch value, dinner, beakfest and so and and press calculate button and it spits out the value for you.

All that works fine, no problems.

Now where i run into a problem is when i click calculate button i want it to to go onto a new page (so i have results displayed there) and i can't seem to figure out how to do that.

Here is the code i have for the button right now

Code:
<input class="buttonx gray" type="button" name="btncalculate" id="btncalculate" value="calculate" onClick="populateform()" a class="revealme"  />
 
The fundamental issue is that HTML is stateless, meaning that calculations on one page are independent of loading another page. You'll need to pass along the results to the new page if you want it displayed there. You can do this with GET arguments in the URL, or use sessions through a server side language like PHP, or you could even use cookies.

I don't really know that you need a new page to show the results. It could be easier to a pop-over using JavaScript that show the results on top of the page, or just show it under the form where they are entering info.

On you code snippet, you have some issues, you have two class attributes, and a "a" in there that does nothing but invalidate the syntax.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.