عندما يركز الماوس على مربع نص عنوان البريد الإلكتروني ، يتم مسح النص "الرجاء إدخال عنوان البريد الإلكتروني" في مربع النص.
صورة التكاثر:
نسخة الكود كما يلي:
<٪@ page language = "c#" autoeventwireup = "true" codeFile = "على غرار التأثير السريع لتسجيل الدخول إلى البريد الإلكتروني 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 () {
// تشغيل مربع العناوين
$ ("#العنوان"). Focus (function () {// مربع العنوان يحصل على تركيز الماوس
var txt_value = $ (this) .val () ؛
if (txt_value == "الرجاء إدخال عنوان بريدك الإلكتروني") {
$ (هذا) .val ("") ؛
}
}) ؛
$ ("#العنوان"). Blur (function () {// مربع العناوين يفقد تركيز الماوس
var txt_value = $ (this) .val () ؛
if (txt_value == "") {
$ (هذا) .val ("الرجاء إدخال عنوان بريدك الإلكتروني") ؛
}
})
// تشغيل مربع كلمة المرور
$ ("#password"). Focus (function () {
var txt_value = $ (this) .val () ؛
if (txt_value == "الرجاء إدخال كلمة مرور البريد الإلكتروني الخاصة بك") {
$ (هذا) .val ("") ؛
}
}) ؛
$ ("#password"). Blur (function () {
var txt_value = $ (this) .val () ؛
if (txt_value == "") {
$ (هذا) .val ("الرجاء إدخال كلمة مرور البريد الإلكتروني") ؛
}
})
}) ؛
</script>
</head>
<body>
<form id = "form1" runat = "server">
<viv>
<type type = "text" id = "address" value = "الرجاء إدخال عنوان بريدك الإلكتروني" /> <br /> <br />
<type type = "text" id = "password" value = "الرجاء إدخال كلمة مرور البريد الإلكتروني" /> <br /> <br />
<type type = "button" value = "login" />
</div>
</form>
</body>
</html>