欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery文本框得到與失去焦點(diǎn)動(dòng)態(tài)改變樣式效果

 更新時(shí)間:2016年09月08日 09:02:30   作者:onestopweb  
這篇文章主要介紹了jQuery文本框得到與失去焦點(diǎn)動(dòng)態(tài)改變樣式效果,涉及jQuery針對(duì)頁(yè)面表單元素樣式的動(dòng)態(tài)操作技巧,需要的朋友可以參考下

本文實(shí)例講述了jQuery文本框得到與失去焦點(diǎn)動(dòng)態(tài)改變樣式效果。分享給大家供大家參考,具體如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<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 type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function(){
  $(":input").focus(function(){
    $(this).addClass("focus");
  }).blur(function(){
    $(this).removeClass("focus");
  });
})
</script>
</head>
<body>
<form action="" method="post" id="regForm">
  <fieldset>
    <legend>個(gè)人基本信息</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">詳細(xì)信息:</label>
      <textarea id="msg" rows="2" cols="20"></textarea>
    </div>
  </fieldset>
</form>
</body>
</html>

運(yùn)行效果圖如下:

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常用插件及用法總結(jié)》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jquery中Ajax用法總結(jié)》、《jQuery常見經(jīng)典特效匯總》、《jQuery動(dòng)畫與特效用法總結(jié)》及《jquery選擇器用法總結(jié)

希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論