基于jquery實現表單文本框添加文字標簽



41 162 55



特效描述:基于jquery實現 表單文本框 添加文字標簽,基于jquery實現表單文本框添加文字標簽

代碼結構

1. 引入CSS

<link href="css/all.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="js/jquery.datetimepicker.css"/>
<link href="css/all.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="js/jquery.datetimepicker.css"/>

2. 引入JS

<script language="javascript" src="js/jquery-1.2.4.js"></script>
<script language="javascript" src="js/biankuai.js"></script>
<script language="javascript" src="js/ui.base.min.js"></script>
<script language="javascript" src="js/ui.droppable.min.js"></script>
<script language="javascript" src="js/ui.draggable.min.js"></script>
<script language="javascript" src="js/ui.sortable.min.js"></script>
<script language="javascript" src="js/drag.js"></script>
<script language="javascript" src="js/drag1.js"></script>
<script language="javascript" src="js/submit.js"></script>
<script language="javascript" src="js/jquery-1.2.4.js"></script>
<script language="javascript" src="js/biankuai.js"></script>
<script language="javascript" src="js/ui.base.min.js"></script>
<script language="javascript" src="js/ui.droppable.min.js"></script>
<script language="javascript" src="js/ui.draggable.min.js"></script>
<script language="javascript" src="js/ui.sortable.min.js"></script>
<script language="javascript" src="js/drag.js"></script>
<script language="javascript" src="js/drag1.js"></script>
<script language="javascript" src="js/submit.js"></script>

3. HTML代碼

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body style="background:#f9f9f9; ">
<div style=" width:100%; height:auto; clear:both; margin-top:18px;   ">
  <div style=" width:1022px; height:auto; border:1px solid #dadada; background:#fff;     margin:0 auto;  ">
    <div class="login" style=" width:780px; margin:20px auto; background:#fafafa;   border:1px solid #e0e0e0; border-bottom:6px solid #e0e0e0;    ">
      <div style="width:775px;     ">
        <form action="" method="get">
        <table width="775" border="0" cellspacing="0" cellpadding="0" style="float:left;">
          <tr id="jq124">
            <td width="219" height="52" align="right" valign="middle" ><label class="i_zt"   ><span style="color:#da4453;">*</span> 主辦單位:</label></td>
            <td height="52" valign="middle"><div class="i_inp"  id="paren"  style="  min-height:30px; cursor:pointer; height:auto;     "> <span    class="ui-sortable disp"  >
                <div id="dc" class="sort"  style="background:#CCC;   white-space:nowrap; float:left; display:block; width:0px; overflow:hidden;      height:22px; font-size:12px;  color:red;">
                  <div  id="dart"  style="  cursor:move; height:22px; display:block; float:left;   line-height:22px; "></div>
                </div>
                </span>
                <input class="ipva"   name=""    type="text" style=" border:none; float:left; display:block; width:auto; outline:none; margin:5px; width:auto; min-width:10px; max-width:200px; background:none; height:22px; line-height:22px; font-size:12px; font-family:微軟雅黑;" />
                <div style="clear:both;"></div>
              </div></td>
            <td width="284"><table   border="0" cellspacing="0" cellpadding="0" class="did">
                <tr>
                  <td height="3"><img src="images/eeee_03.png" alt="" /></td>
                  <td height="3" style="background:url(images/eeee_05.png) repeat-x #f9f9f9"></td>
                  <td height="3"><img src="images/eeee_06.png" alt="" /></td>
                </tr>
                <tr>
                  <td width="30" valign="top"  style="background:url(images/err_11.png) repeat-y #f9f9f9"><img src="images/eeee_08.png" alt="" /></td>
                  <td style="background:#f9f9f9; line-height:16px; padding:5px 3px; font-size:12px; font-family:宋體;">輸入學科后<span style="color:#da4453;">回車</span>即可添加更多單位
                    </td>
                  <td style="background:url(images/eeee_10.jpg) repeat-y #f9f9f9"></td>
                </tr>
                <tr>
                  <td><img src="images/eeee_11.png" alt="" /></td>
                  <td style="background:url(images/eeee_12.png) repeat-x #f9f9f9"></td>
                  <td><img src="images/eeee_13.png" alt="" /></td>
                </tr>
              </table></td>
          </tr>
          <tr id="jq124">
            <td width="219" height="52" align="right" valign="middle"  ><label class="i_zt"   >協辦單位:</label></td>
            <td height="52" valign="middle"><div class="i_inp"  id="paren"  style="  min-height:30px; cursor:pointer; height:auto;     "> <span    class="ui-sortable disp"  >
                <div id="dc" class="sort"  style="background:#CCC;   white-space:nowrap; float:left; display:block; width:0px; overflow:hidden;      height:22px; font-size:12px;  color:red;">
                  <div  id="dart"  style="  cursor:move; height:22px; display:block; float:left;   line-height:22px; "></div>
                </div>
                </span>
                <input class="ipva"   name=""    type="text" style=" border:none; float:left; display:block; width:auto; outline:none; margin:5px; width:auto; min-width:10px; max-width:200px; background:none; height:22px; line-height:22px; font-size:12px; font-family:微軟雅黑;" />
                <div style="clear:both;"></div>
              </div></td>
            <td width="284"><table   border="0" cellspacing="0" cellpadding="0" class="did">
                <tr>
                  <td height="3"><img src="images/eeee_03.png" alt="" /></td>
                  <td height="3" style="background:url(images/eeee_05.png) repeat-x #f9f9f9"></td>
                  <td height="3"><img src="images/eeee_06.png" alt="" /></td>
                </tr>
                <tr>
                  <td width="30" valign="top"  style="background:url(images/err_11.png) repeat-y #f9f9f9"><img src="images/eeee_08.png" alt="" /></td>
                  <td style="background:#f9f9f9; line-height:16px; padding:5px 3px; font-size:12px; font-family:宋體;">回車即可添加<span style=" color:#F00;"></span>更多語言</td>
                  <td style="background:url(images/eeee_10.jpg) repeat-y #f9f9f9"></td>
                </tr>
                <tr>
                  <td><img src="images/eeee_11.png" alt="" /></td>
                  <td style="background:url(images/eeee_12.png) repeat-x #f9f9f9"></td>
                  <td><img src="images/eeee_13.png" alt="" /></td>
                </tr>
              </table></td>
          </tr>
          <tr  >
            <td width="219" height="52" align="right" valign="middle"  ><label class="i_zt"   >聯辦單位:</label></td>
            <td height="52" valign="middle"><div class="i_inp"  id="paren"  style="  min-height:30px; cursor:pointer; height:auto;     "> <span    class="ui-sortable disp"  >
                <div id="dc" class="sort"  style="background:#CCC;   white-space:nowrap; float:left; display:block; width:0px; overflow:hidden;      height:22px; font-size:12px;  color:red;">
                  <div  id="dart"  style="  cursor:move; height:22px; display:block; float:left;   line-height:22px; "></div>
                </div>
                </span>
                <input class="ipva"   name=""    type="text" style=" border:none; float:left; display:block; width:auto; outline:none; margin:5px; width:auto; min-width:10px; max-width:200px; background:none; height:22px; line-height:22px; font-size:12px; font-family:微軟雅黑;" />
                <div style="clear:both;"></div>
              </div></td>
            <td width="284"><table   border="0" cellspacing="0" cellpadding="0" class="did">
                <tr>
                  <td height="3"><img src="images/eeee_03.png" alt="" /></td>
                  <td height="3" style="background:url(images/eeee_05.png) repeat-x #f9f9f9"></td>
                  <td height="3"><img src="images/eeee_06.png" alt="" /></td>
                </tr>
                <tr>
                  <td width="30" valign="top"  style="background:url(images/err_11.png) repeat-y #f9f9f9"><img src="images/eeee_08.png" alt="" /></td>
                  <td style="background:#f9f9f9; line-height:16px; padding:5px 3px; font-size:12px; font-family:宋體;">回車即可添加<span style=" color:#F00;"></span>更多單位</td>
                  <td style="background:url(images/eeee_10.jpg) repeat-y #f9f9f9"></td>
                </tr>
                <tr>
                  <td><img src="images/eeee_11.png" alt="" /></td>
                  <td style="background:url(images/eeee_12.png) repeat-x #f9f9f9"></td>
                  <td><img src="images/eeee_13.png" alt="" /></td>
                </tr>
              </table></td>
          </tr>
          <tr>
            <td width="219" height="52" align="right" valign="middle"  ><label class="i_zt"   >贊助單位:</label></td>
            <td height="52" valign="middle"><div class="i_inp"  id="paren"  style="  min-height:30px; cursor:pointer; height:auto;     "> <span    class="ui-sortable disp"  >
              <div id="dc" class="sort"  style="background:#CCC;   white-space:nowrap; float:left; display:block; width:0px; overflow:hidden;      height:22px; font-size:12px;  color:red;">
                <div  id="dart"  style="  cursor:move; height:22px; display:block; float:left;   line-height:22px; "></div>
                </div>
              </span>
              <input class="ipva"   name=""    type="text" style=" border:none; float:left; display:block; width:auto; outline:none; margin:5px; width:auto; min-width:10px; max-width:200px; background:none; height:22px; line-height:22px; font-size:12px; font-family:微軟雅黑;" />
              <div style="clear:both;"></div>
              </div></td>
            <td width="284"><table   border="0" cellspacing="0" cellpadding="0" class="did">
              <tr>
                <td height="3"><img src="images/eeee_03.png" alt="" /></td>
                <td height="3" style="background:url(images/eeee_05.png) repeat-x #f9f9f9"></td>
                <td height="3"><img src="images/eeee_06.png" alt="" /></td>
                </tr>
              <tr>
                <td width="30" valign="top"  style="background:url(images/err_11.png) repeat-y #f9f9f9"><img src="images/eeee_08.png" alt="" /></td>
                <td style="background:#f9f9f9; line-height:16px; padding:5px 3px; font-size:12px; font-family:宋體;">回車即可添加<span style=" color:#F00;"></span>更多單位</td>
                <td style="background:url(images/eeee_10.jpg) repeat-y #f9f9f9"></td>
                </tr>
              <tr>
                <td><img src="images/eeee_11.png" alt="" /></td>
                <td style="background:url(images/eeee_12.png) repeat-x #f9f9f9"></td>
                <td><img src="images/eeee_13.png" alt="" /></td>
                </tr>
              </table></td>
          </tr>
        </table>
                 </form>
      </div>
      <div style="width:775px;     "></div>
      <div style="clear:both;"></div>
    </div>
    <div style="clear:both;"></div>
  </div>
  <div style="clear:both;"></div>
</div>
</body>
</html>
<script>
  $(function(){ 
      $(".sanjiao").click(function(){		 $(this).parent().find("ul").toggle();	   })
	      $(".iise li ul").hide()	
	  $(".i_iop").focus(function(){		     $(this).parent().parent().find("td:eq(2) .did").fadeIn();  })
	  $(".i_iop").blur(function(){		     $(this).parent().parent().find("td:eq(2) .did").fadeOut(1);  }) 
		  $(".i_inp .ipva").focus(function(){	 $(this).parent().parent().parent().find("td:eq(2) .did").fadeIn();  })
	      $(".i_inp .ipva").blur(function(){	 $(this).parent().parent().parent().find("td:eq(2) .did").fadeOut(1);  })
	    })
	function submitbt(){
	 if($(".i_iop:eq(0)").val() == ""){
	  $(".i_iop:eq(0)").focus();
	  $(".i_iop:eq(0)").parent().parent().find("td:eq(2) table.did tr:eq(1) td:eq(1)").html("<span style='color:#f00;' >此項內容為必填,不能為空。</span>")  
				}
	  $(".i_iop:eq(0)").blur(function(){    $(this).parent().parent().find("td:eq(2) table.did tr:eq(1) td:eq(1)").html("主標題")    }) 
			} 
</script>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>



用戶評論
大牛,別默默的看了,快登錄幫我點評一下吧!:)      登錄 | 注冊


熱門標簽: 文字疊加 文字層疊 文字收縮展開 文字收縮 文字展開 文字提示框 提示文字 文字翻轉 文字旋轉 文字拖動 文字拖拽 文字淡出淡進 文字淡出 文字淡進 文字全屏 文字延遲加載 文字延遲 文字加載 文字放大縮小 文字縮放 文字大小 文字放大 文字縮小 文字變大 文字變小 360全景 360度全景 h5文字動畫 h5文字邊框動畫 html5文字動畫 html5文字邊框動畫 拖動 拖拽 拖動插件 拖拽插件 文字切換 文字選項卡 文字滑動 文字滑塊 文字滾動 文字無縫滾動 文字間歇滾動 彈出層拖動 窗口 彈出 彈窗 彈出層 提示框 對話框 遮罩 遮罩層 彈窗插件 圖片文字 文字導航菜單 文字導航 文字菜單 切換按鈕 表單 表單美化 表單插件 表單美化插件 文字 文字插件 文字標簽 文字標簽云 標簽云 文字拖動 文字拖拽 文字提示框 提示文字 文本框 text文本框
?
×
×

注冊

官方QQ群

掃描上面二維碼加微信群

官方QQ群

jQuery/js討論群
群號:642649996
Css3+Html5討論群
群號:322131262

加群請備注:從官網了解到

湖北30选5开奖结果走势图表