Question

Asked on 2002-03-14 at 14:12:44ID: 25439664

Need to combine two scripts

by: beegled75

Rating8.2Very Good

Hello,

I have two scripts that I would like to combine.  The first does tow things.  It keeps IE users from using the enter key to submit a form and it disables the submit and reset buttons after a user has clicked submit.  The second script confirms whether or not the user actually wishes to submit the form.  The problem is that if the user decides they do not wish to submit the form, the submit button is still disabled.  Can the two scripts be combined so that if they choose not to submit the form then the button is reactivated?  Any help is greatly appreciated.  Thank you.

<SCRIPT LANGUAGE="JavaScript">
<!--
function onKeyPress (){
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;
if (keycode == 13){
return false
}
return true
}
document.onkeypress = onKeyPress;
function submitonce(theform){
if (document.all||document.getElementById){
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
tempobj.disabled=true
}
}
}
// -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree)
return true;
else
return false;
}
// -->
</SCRIPT>

Related Solutions

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution

View This Solution - Start Your 30 Day Free Trial
Zone
general
Tags
Participating Experts
1
Solution Grade
A

Replies

 by: fritz_the_blank

Posted on 2002-03-14 at 14:19:43ID: 28115891

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: fritz_the_blank

Posted on 2002-03-14 at 14:31:59ID: 28115892

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: beegled

Posted on 2002-03-14 at 14:44:41ID: 28115893

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: fritz_the_blank

Posted on 2002-03-14 at 15:04:38ID: 28115894

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: beegled

Posted on 2002-03-14 at 16:09:06ID: 28115895

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: fritz_the_blank

Posted on 2002-03-14 at 16:56:59ID: 28115896

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: beegled

Posted on 2002-03-14 at 17:17:02ID: 28115897

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: fritz_the_blank

Posted on 2002-03-15 at 05:29:08ID: 28115898

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: fritz_the_blank

Posted on 2002-03-15 at 06:50:11ID: 28115899

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: beegled

Posted on 2002-03-15 at 11:08:30ID: 28115900

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: beegled

Posted on 2002-03-15 at 11:09:20ID: 28115901

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: fritz_the_blank

Posted on 2002-03-15 at 11:44:45ID: 28115902

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Log In

Forgot your password?Sign up

Top Experts

  1. mplungjan

    1,840

    0 points yesterday

    Profile

BrowseAre you an Expert?