nachinwallace Posted July 29, 2009 Report Share Posted July 29, 2009 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>unijimpe: Auto-Clear Input Text</title> <script type="text/javascript"> function init(){ var inp = document.getElementsByTagName('input'); for(var i = 0; i < inp.length; i++) { if(inp.type == 'text') { inp.setAttribute('rel', inp.defaultValue); inp.onfocus = function() { if(this.value == this.getAttribute('rel')) { this.value = ''; } else { return false; } } inp.onblur = function() { if(this.value == '') { this.value = this.getAttribute('rel'); } else { return false; } } inp.ondblclick = function() { this.value = this.getAttribute('rel') } } } } if(document.childNodes) { window.onload = init } </script> <style type="text/css"> <!-- #scale { color: #FFFFFF; background-color: #FF3366; height: 26px; width: 200px; border: 1px solid #CC0066; line-height: 26px; padding-left: 4px; } body { font-family: "Trebuchet MS", Tahoma, Verdana; color: #666666; text-decoration: none; font-size: 12px; } #drag { color: #FFFFFF; background-color: #FF3333; height: 26px; width: 200px; border: 1px solid #CC0033; line-height: 26px; padding-left: 4px; } input { font-family:"Trebuchet MS", Tahoma, Verdana; font-size: 12px; } --> </style> </head> <body> <strong>Registro de Usuarios:</strong><br /> Nombre:<br /> <input type="text" id="name" value="Nombre" /><br /> Email:<br /> <input type="text" id="name" value="Email" /><br /> Web:<br /> <input type="text" id="web" value="Direccion Web" /><br /> <input name="btsend" type="button" value="Enviar" /> </body> </html> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now