Re: Text Changed on Web Form
document.form.txtPassword.style.backgroundColor = "#FFFFFF";
The above will change the textbox background color. You need to set this in the javascript method.
Hope this helps
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<meta name="Content-Style-Type" content="text/css">
<title>Example</title>
<script type="text/javascript">
function checkform()
{
var pass=document.getElementById('txtPassword');
var confirmpass=document.getElementById('txtconfirmPassword');
if (pass.value != confirmpass.value)
{
pass.style.backgroundColor = "#FFFF00";
confirmpass.style.backgroundColor = "#FFFF00";
alert('Passwrod doenst match');
return false;
}
return true;
}
</script>
<style type="text/css">
form { margin:auto; width:11em}
fieldset {padding:1ex}
label {display:block; margin:0; text-align:left}
label.highlight {background-color:#aaa}
label.highlight input {background-color:#a00}
button {display:block; margin:auto}
</style>
</head>
<body>
<form onsubmit="return checkform();">
<fieldset>
<legend>Example</legend>
<label>Password<input type="PASSWORD" Name="txtPassword"></label>
<label>Confirm Passwrod<input type="PASSWORD" Name="txtconfirmPassword"></label>
<button type="submit">Submit</button>
</fieldset>
</form>
</body>
</html>
Re: Text Changed on Web Form
Hello,
Based on what you have asked, I am assuming you are trying to allow the creation of users on your website. Have you considered using the ASP.Net Membership Provider, and it's associated controls? For instance the CreateUserWizard and the ChangePassword control would handle all of this work for you.
Gary