View Full Version : Calling function not working

12-30-2007, 04:03 AM
Probley a noob error i just cant see it any help pls

<script type="text/javascript">
function user()

function pass()
document.login.pass.type = 'password';

<center>Chat Login
<form name="login" methord="post">
<tr><input type="text" name="user" onclick="javascript:user()" value="Username"/></tr>
<tr><input type="text" name="pass" onclick="javascript:pass()" value="Password"/></tr>
<tr><input type="submit" name="go" value="login" disabled/></tr>

Can any one see the error if so pls post

There is another Error when i use this code tho

<input type="text" name="pass" onclick="javascript:document.login.pass.type='password';" value="Password"/>
but what i read this is a IE error not a Javascript error

12-30-2007, 01:05 PM
There are a number of validation errors in your page. However, I have to admit that even if these are fixed, you still get a javascript error 'user() is not a function' or 'pass() is not a function.

<center>Chat Login
<form id="login" name="login" method="post" action="" >
<td><input type="text" id="user" name="user" onclick="user();" value="Username" /></td>
<td><input type="text" id="pass" name="pass" onclick="pass();" value="Password" /></td>
<td><input type="submit" name="go" value="login" disabled="disabled" /></td>


12-30-2007, 02:16 PM
name your functions differently from your form elements, that can cause problems.

You can't change the type of input elements once they're part of the document, so you'll either have to replace the element with a new one, or why not just use labels?