skateme
09-22-2008, 07:56 PM
I want to replace the value of an input text field to 0 (nothing) if the user clicks on the field or if the user clicks out of the field. I already have this code going, but I want to prevent the code from changing the input's value if the user has modified the contents of the input. I have this code so far:
<html>
<head>
<style>
function changevalue(){
if(document.loginform.test.value == 'test'){
document.loginform.test.value = "";
}
</style>
</head>
<body>
<div class="loginform">
<input type="text" value="test" id="test" name="test" onclick="this.value=''" onchange="" />
</div>
<div onclick="test.value='test'" style="width:100%;height:100%; position: absolute;">
</div>
</body>
</html>
Let me know if any clarification is needed :) Thanks in advance!
<html>
<head>
<style>
function changevalue(){
if(document.loginform.test.value == 'test'){
document.loginform.test.value = "";
}
</style>
</head>
<body>
<div class="loginform">
<input type="text" value="test" id="test" name="test" onclick="this.value=''" onchange="" />
</div>
<div onclick="test.value='test'" style="width:100%;height:100%; position: absolute;">
</div>
</body>
</html>
Let me know if any clarification is needed :) Thanks in advance!