[thelist] Javascript - form action reference problem

Martyn Haigh martyn.haigh at virgincosmetics.com
Fri Feb 7 08:27:40 CST 2003


I'm having a problem with this bit of JS.
It comes up with a JS error on this line :
document.forms['login'].action = "login.asp?a="+action;

When I click the 'Resend pass' link near the bottom.

I'm not very good with JS - and can't see why this is failing.
 The line :
setTimeout("document.forms['login'].elements['pass'].focus();",100);
works fine...so I think I'm not referencing the action object of the form
properly, but can't for the life of me work out the right way to do it.

 Can anyone help me out.

<code>

<script type="text/javascript">

function submitform(action)
{
	document.forms['login'].action = "login.asp?a="+action;
	document.forms['login'].submit();
}
setTimeout("document.forms['login'].elements['pass'].focus();",100);

</script>

......


<form id="login" name="login" method="post" action="login.asp">
<div class="centered">
	<div class="logincontainer">
	  <div class="loginheader">Login</div>
		<div class="logincontent">

			<label for="user">Name</label>
			<input id="user" type="text" size="13" name="user"
/>
			<br />
			<label for="pass">Password</label>
			<input id="pass" name="pass" type="password"
size="13" />
			<br />

			<br />
			<input name="submit" type="submit" value="Login" />

			<input type="hidden" name="dir" value="" />
			<input type="hidden" name="ma" value="" />
			<input type="hidden" name="m" value="" />
			<input type="hidden" name="goto" value="" />
			<input type="hidden" name="a" value="login" />
	  </div>
	</div>
<a href="javascript:submitform('sendpass');">Resend pass</a><br /><br />
</div>
</form>

</code>

Thank you very much

Martyn Haigh

Site Developer



DISCLAIMER: The information in this email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this email by
anyone else is unauthorised. If you are not the intended recipient, any
disclosure, copying, distribution or any action taken or omitted to be taken
in reliance on it, is prohibited and may be unlawful.





More information about the thelist mailing list