mehran63
پنج شنبه 23 آذر 1391, 20:04 عصر
سلام
همانطر که میدانید این دو برای این است که فوکوس از عنصری که در درون یک عنصر دیگر قرار گرفته است گرفته شود یا داده شود. ولی در کد زیر این عمل انجام نمیگیرد
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
<!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 runat="server">
<title>Untitled Page</title>
<script src="scripts/jQuery.js" type="text/javascript"></script>
<script src="scripts/my-JScript.js" type="text/javascript"></script>
<style type="text/css">
.btn1
{
background-color:Aqua;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<asp:DropDownList ID="DropDownList1" runat="server"
onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true">
<asp:ListItem>guilan</asp:ListItem>
<asp:ListItem>tehran</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:DropDownList ID="DropDownList2" runat="server">
</asp:DropDownList>
<br />
<br />
<div id="divTextBox">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</div>
<br />
<br />
<asp:Button ID="Button1" CssClass="btn1" runat="server" onclick="Button1_Click" Text="Button" />
<p>Hellooooo</p>
<p>Mehran</p>
</div>
</form>
</body>
</html>
$("document").ready(function () {
$("#divTextBox").focusin(function (e) {
e.preventDefault();
$("this").css("background-color", "#B4DB6F");
});
$("#divTextBox").focusout(function (e) {
e.preventDefault();
$("this").css("background-color", "#B6DE8F");
});
});
همانطر که میدانید این دو برای این است که فوکوس از عنصری که در درون یک عنصر دیگر قرار گرفته است گرفته شود یا داده شود. ولی در کد زیر این عمل انجام نمیگیرد
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
<!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 runat="server">
<title>Untitled Page</title>
<script src="scripts/jQuery.js" type="text/javascript"></script>
<script src="scripts/my-JScript.js" type="text/javascript"></script>
<style type="text/css">
.btn1
{
background-color:Aqua;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<asp:DropDownList ID="DropDownList1" runat="server"
onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true">
<asp:ListItem>guilan</asp:ListItem>
<asp:ListItem>tehran</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:DropDownList ID="DropDownList2" runat="server">
</asp:DropDownList>
<br />
<br />
<div id="divTextBox">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</div>
<br />
<br />
<asp:Button ID="Button1" CssClass="btn1" runat="server" onclick="Button1_Click" Text="Button" />
<p>Hellooooo</p>
<p>Mehran</p>
</div>
</form>
</body>
</html>
$("document").ready(function () {
$("#divTextBox").focusin(function (e) {
e.preventDefault();
$("this").css("background-color", "#B4DB6F");
});
$("#divTextBox").focusout(function (e) {
e.preventDefault();
$("this").css("background-color", "#B6DE8F");
});
});