...

View Full Version : I need help on a javascript/html problem!



daltman1967
03-11-2009, 08:11 PM
here is part of my code:
...
<script language="Javascript">

function Calc(Atext, Btext, form)
{
...
}
</script>

...
<form action="" name="Calculator" METHOD="post" onsubmit="return Calc(this.Amt.value, this.APR.value, this)" style="z-index: 1; width: 565px; height: 47px; position: absolute; top: 128px; left: 309px">
...

The form takes the values in the Amt and APR textboxes and automatically formats them. Once you click the "Calculate" button (a graphic image), the program calls the onsubmit to the Calc function, which then properly validates the text and processes it. The idea here was to convert the answer from a text answer (i.e., "$125.00") into pictures. I have the individual picture files linked. Everything works right...

...except...

Not long after the answer appears on the screen, the page reloads or refreshes or whatever. I've been pulling my hair out on this! I want the page to stay up once everything's complete, and make no changes at all until (unless) the user clicks another button. Can anyone help?

Old Pedant
03-11-2009, 09:00 PM
Are you making sure that your Calc( ) function *ALWAYS* returns false??? If not, the submit of the <form> will go ahead and take place.

Maybe an easier way to make sure this doesn't happen is via:


<form action="" name="Calculator" METHOD="post"
onsubmit="Calc(this.Amt.value, this.APR.value, this); return false;"
style="z-index: 1; width: 565px; height: 47px; position: absolute; top: 128px; left: 309px">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum