hsperhar
12-01-2008, 03:10 PM
Hi
I have a javascript function as follows in my page which
<script language="javascript">
function password_check()
{
if(document.getElementById('new_pass1').value==document.getElementById('new_pass2').value) { document.getElementById('log1').submit();
} else{//some another activity. } }
</script>
This script is getting used by a button in HTML body,detailed below:
<body>
<form name="log" method="POST" action="<%=user_ver%>" id="log1">
<!--<%=user_ver%> is the jsp code for the address of the servlet,which doesnot have any kind of problem -->
<input name="new_pass1" type="password" id="new_pass1" size="50%" align="middle"><br>
<input name="new_pass2" type="password" id="new_pass2"
size="50%" align="middle" ><br>
<input name="Submit" onclick="password_check()" size="50" type="button" id="Submit" value="SubmiT" align="middle">
</form></body>
My problem is that when I hit SubmiT button it fires an error saying that document.getElementById('log1') is null. If I chnage that piece of code in function with document.log.submit(); then it says that document.log is not defined. Could you help me in this and also to find what's going wrong in this?
I have a javascript function as follows in my page which
<script language="javascript">
function password_check()
{
if(document.getElementById('new_pass1').value==document.getElementById('new_pass2').value) { document.getElementById('log1').submit();
} else{//some another activity. } }
</script>
This script is getting used by a button in HTML body,detailed below:
<body>
<form name="log" method="POST" action="<%=user_ver%>" id="log1">
<!--<%=user_ver%> is the jsp code for the address of the servlet,which doesnot have any kind of problem -->
<input name="new_pass1" type="password" id="new_pass1" size="50%" align="middle"><br>
<input name="new_pass2" type="password" id="new_pass2"
size="50%" align="middle" ><br>
<input name="Submit" onclick="password_check()" size="50" type="button" id="Submit" value="SubmiT" align="middle">
</form></body>
My problem is that when I hit SubmiT button it fires an error saying that document.getElementById('log1') is null. If I chnage that piece of code in function with document.log.submit(); then it says that document.log is not defined. Could you help me in this and also to find what's going wrong in this?