Code:
<head>
<!-- ... -->
<style type="text/css">
form.blockLabels label {
display: block;
}
</style>
<script type="text/javascript">
var loginValues = {
'admin' : "adminPassword",
'demo' : "demoPassword"
};
function setValues(id) {
var f = this.elements;
if(loginValues[id]) {
f['user'].value = id;
f['pass'].value = loginValues[id];
}
}
</script>
</head>
<!-- ... -->
<form action="loginpage.psp" class="blockLabels">
<label>
<input type="checkbox" onclick="setValues.call(this.form, 'admin');">
Admin
</label>
<label>
<input type="checkbox" onclick="setValues.call(this.form, 'demo');">
Demo
</label>
<label>
Username:
<input type="text" name="user">
</label>
<label>
Password:
<input type="password" name="pass">
</label>
</form>
Note that this requires Javascript and will not be available to users without Javascript support. I must wonder, also, what purpose this is intended to serve.
Bookmarks