PDA

View Full Version : form related javascript


cunning-fox
09-20-2002, 12:19 AM
Hi,

I have a page where I need new visitors to be able to use a demo login.

I was thinking that the user could click a button named "demo", and javascript would fill in "demo user" for the field name "login", and "guest" for the field name "password". All with the click of a button.

Help is greatly appreciated

umm
09-20-2002, 12:34 AM
somehting like this?

<html>
<head>
<title>Example</title>
<script language="javascript" type="text/javascript">
<!-- ;
function fillItIn(f){
f.userName.value="demo_user";
f.psw.value="guest"
}
// -->
</script>
</head>
<body>
<form name="f1">
<input type="text" name="userName" />User Name<br />
<input type="password" name="psw" />Password<br />
<input type="button" value="Demo" onclick="fillItIn(this.form)"/>
</form>
</body>
</html>