<input onclick=validate not working?

it is not validating the amt1 input box?
Any idea why?

<script language="JavaScript" type="text/javascript">
            function validate()
                    if(document.test4.Amt1.value == '0')
                          alert('Please enter donation amount greater than $0');
                        return false;

<form name="test4" style="color: #000080;" action="submit.asp" method="get">
<table style="width: 400px; height: 150px">
<tr><td colspan="2"></td></tr>
<select name="programURL">
<option value="">Select Program </option>
<tr><td>Amount</td><td><input name="Amt1" size="8" maxlength="8" style="width: 70px; height: 20px;" class="style9" value="0"/></td></td></tr>
<tr><td colspan="2">
<input type="image" src="Donate.gif" border="0" name="submit" width="92" height="26" class="style5" onclick="javascript:validate();">


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
You probably need to put it in your form tag like this:

<form name="test4" style="color: #000080;" action="submit.asp" method="get" onsubmit="return validate();">

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Wayne BarronAuthor, Web DeveloperCommented:
Why don't you use Server Side validation instead of JavaScript.

In this case, you could do something like this.

This will go on the process page.
Amt1 = request.form("Amt1")
if Amt1=0 then
response.write"Please enter donation amount greater than $0"
' do what you need to do here.
end if

what browser did you use for testing?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.