Jqueryテキストボックスがフォーカスの色を失い、取得
1752 ワード
<style type="text/css">
body
{
font: normal 12px/17px Arial;
}
div
{
padding: 2px;
}
input, textarea
{
width: 12em;
border: 1px solid #888;
}
.focus
{
border: 1px solid #f00;
background: #fcc;
}
</style>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"/>
<script type="text/javascript">
$(function () {
$("input").focus(function () {
$(this).addClass("focus");
}).blur(function () {
$(this).removeClass("focus");
});
});
</script>
<form id="form1" runat="server">
<fieldset>
<legend> </legend>
<div>
<label for="username">
:</label>
<input id="username" type="text"/>
</div>
<div>
<label for="pass">
:</label>
<input id="pass" type="password"/>
</div>
<div>
<label for="msg">
:</label>
<textarea id="msg" rows="2" cols="20"/>
</div>
</fieldset>
</form>
</code></pre>
<br/>
</div>
</div>
</div>
</div>