Quando o mouse se concentrar na caixa de texto Endereço de email, o texto "Insira o endereço de e -mail" na caixa de texto é limpo.
Imagem de reprodução:
A cópia do código é a seguinte:
< %@ Página de página = "c#" autoeventwireup = "true" codefile = "semelhante ao efeito imediato do yahoo email login.aspx.cs" herits = "semelhante ao efeito imediato do login de e -mail do yahoo" %>
<! Doctype html>
<html xmlns = "http://www.w3.org/1999/xhtml">
<Head Runat = "Server">
<meta http-equiv = "content-type" content = "text/html; charset = utf-8"/>
<Title> </title>
<script type = "text/javascript" src = "scripts/jQuery-1.7.1.js"> </script>
<script type = "text/javascript">
$ (function () {
// opera a caixa de endereço
$ ("#endereço"). Focus (function () {// A caixa de endereço obtém o foco do mouse
var txt_value = $ (this) .val ();
if (txt_value == "Por favor, digite seu endereço de e -mail") {
$ (this) .val ("");
}
});
$ ("#endereço"). Blur (function () {// A caixa de endereço perde o foco do mouse
var txt_value = $ (this) .val ();
if (txt_value == "") {
$ (this) .val ("insira seu endereço de e -mail");
}
})
// opere a caixa de senha
$ ("#senha"). Focus (function () {
var txt_value = $ (this) .val ();
if (txt_value == "Por favor, digite sua senha de e -mail") {
$ (this) .val ("");
}
});
$ ("#senha"). Blur (function () {
var txt_value = $ (this) .val ();
if (txt_value == "") {
$ (this) .val ("Insira a senha de email");
}
})
});
</script>
</head>
<Body>
<form id = "form1" runat = "server">
<div>
<input type = "text" id = "endereço" value = "digite seu endereço de e -mail" /> <r /> <r />
<input type = "text" id = "senha" value = "digite a senha de email" /> <r /> <r />
<input type = "button" value = "login" />
</div>
</morm>
</body>
</html>