2010-04-29 90 views

回答

0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html lang="en"> 
    <head> 
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 
    <title>labelOver Example</title> 
    <style type="text/css" media="screen"> 
    <!-- 
     BODY { margin: 10px; padding: 0; font: 1em "Trebuchet MS", verdana, arial, sans-serif; } 
     BODY { font-size: 100%; } 
     H1 { margin-bottom: 2px; font-family: Garamond, "Times New Roman", Times, Serif;} 
     DIV.container { margin: auto; width: 90%; margin-bottom: 10px;} 
     TEXTAREA { width: 80%;} 
     FIELDSET { border: 1px solid #ccc; padding: 1em; margin: 0; } 
     LEGEND { color: #ccc; font-size: 120%; } 
     INPUT, TEXTAREA { display: block; clear: left; font-family: Arial, verdana; font-size: 125%; padding: 7px; border: 1px solid #999; margin: 10px; } 
     #f DIV.label { position: relative; float: left; margin-right: 3px; clear: left; } 
     DIV.clear { clear: both; } 
     LABEL.over { color: #ccc; position: absolute; top: 20px; left: 20px;} 
    --> 
    </style> 

    <link rel="stylesheet" type="text/css" href="/master.css" /> 
    <script src="/js/jquery.js" type="text/javascript"></script> 
    <script src="label_over.js" type="text/javascript" charset="utf-8"></script> 

    <script type="text/javascript"> 
    <!-- 
     $(function() { 
     $('#f').submit(function() { 
      $('legend', this).html('Example with labelOver'); 
      $('label').labelOver('over'); 
      return false; 
     }) 
     $('label.pre').labelOver('over'); 
     }) 
    //--> 
    </script> 
    </head> 
    <body id="page"> 
    <div id="doc"> 
     <h1>labelOver Example</h1> 
     <form action="" id="f"> 
      <fieldset> 
      <legend>Example without labelOver</legend> 
      <div class="label"> 
      <label class="pre" for="applied">Applied</label> 
      <input type="text" name="applied" value="" id="applied" /> 
      </div> 
      <div class="label"> 
      <label for="search">Search</label> 
      <input type="text" name="search" value="" id="search" /> 
      </div> 
      <div> 
      <input type="submit" name="submit" value="Apply label over" id="submit" /> 
      </div> 
      <div class="clear"></div> 
      </fieldset> 
     </form> 
    </div> 
    </body> 
</html> 
0

我假設你在談論this jQuery插件。有一個鏈接到working demo

+0

我看到演示,但代碼在哪裏?除非我錯過了 – 2010-04-29 15:40:29

+0

在演示上查看源代碼以查看代碼。 – Tejs 2010-04-29 15:43:10

+0

@Tejs:它不會允許你顯示源代碼,我試過兩種不同的機器,我使用的是IE8,甚至試圖保存該頁面,但該頁面不顯示soure代碼:) – 2010-04-29 15:46:45