Problem in disabling Buttons

Here is my code. I'm not able to disable the button. What could be the problem?

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="Error.jsp" %>

<HTML>

<HEAD>

<TITLE>Guest Houses of DOS</TITLE>

<LINK REL="STYLESHEET" TYPE="TEXT/CSS" HREF="trm.css">

<%@ include file="StdValidations.js" %>

<script>

function EnterTo()

{

document.LoginForm.submit1.disabled="true";

document.LoginForm.submit();

}

function ClearFields()

{

document.LoginForm.LoginName.value = "";

document.LoginForm.Password1.value = "";

}

</script>

</HEAD>

<center>

<BODY>

<form name = "LoginForm" action = "UserAdmin.jsp" method="post">

<table width="80%" bgcolor="#B6C7E5">

<tr valign="top">

<td align="center">

<table>

<tr>

<td>

<img src="Images/Title.gif" >

</td>

</tr>

<tr>

<td align="center">

<P >

Login Name : <INPUT id=text1 name=LoginName>

</P>

<P>

Password : <INPUT id="Password1" name="Password" type="Password">

</P>

<INPUT name="submit1" type="submit" value="Login" onClick="EnterTo()" >

<INPUT name="reset1" type="reset" value="Cancel" class="Button" onClick="ClearFields()" >

</td>

</tr>

</table>

</td>

<td " align="center">

<img src="Images/guesthouse.jpg" align="right">

</td>

</tr>

</table>

<table width="80%" bgcolor="#B6C7E5">

<tr >

<td align=right>

<b>-- Powered By INSES,ISRO-HQ,Bangalore</b>

</td>

</tr>

<tr>

<td align=right>

<b>For suggestions<img src="Images/em1.jpg"></b>

</td>

</tr>

</table>

[2172 byte] By [harinibiligiria] at [2007-11-26 15:13:30]
# 1

first things use following way to import js files

<SCRIPT src="javascriptfile.s" type=text/javascript></SCRIPT>

secondly.....

if you submitting the form using javascript method remove the action attribute from the form.

and your code is working fine in my system.....

only thing is that it is not staying there due to form is submitted

you can check by putting an alert as i did in following code

function EnterTo()

{

document.LoginForm.submit1.disabled="true";

// add the following line

alert('disabled or not');

document.LoginForm.submit();

}

krish1315a at 2007-7-8 9:04:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
This should work, I don't see any issue here. As soon as you disable the button you're posting the form. try this:<INPUT name="submit1" type="submit" value="Login" onClick="this.disabled=true;EnterTo()">
skp71a at 2007-7-8 9:04:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...