Texto sumir ao clicar no campo de texto
6 de outubro de 2011
[sourcecode language=”Javascript”]
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function EmptyField(id)
{
var Fid = document.getElementById(id);
var TheDefaultValue = Fid.defaultValue;
var TheValue = Fid.value;
//alert(TheDefaultValue+" "+TheValue)
if(TheDefaultValue == TheValue)
{
Fid.value = ”;
}else if(TheValue == ""){
Fid.value = ‘DIGITE O PRODUTO QUE DESEJA’;
}
$(‘#busca’).value(”);
}
function mostrarTexto(id){
}
</script>
</head>
<body>
<form action="#" method="POST">
<input class="input" id="bSite" name="busca" type="text" value="Busca no Site" onfocus="EmptyField(this.id);" />
</form>
</body>
</html>
[/sourcecode]
Posted in Dicas, JavaScript