Your problem is that you try to use a submit button, and the submit action to do something in JavaScript, which is an error. The submit process changes the session, and any changing of the session will make all the javascript calculation lost.
You may block the submit action by returning false:
function ques1() {
// whichever code
[COLOR="Blue"]return false[/COLOR]
}
...
...
<form action=[COLOR="Blue"]""[/COLOR] name="ques1" [COLOR="Blue"]onsubmit="return ques1()"[/COLOR]>
Or you may simply use a type="button" input, not a submit one:
<form action=[COLOR="Blue"]""[/COLOR] name="ques1">
...
<input [COLOR="Blue"]type="button"[/COLOR] value="Submit" />
</form>