日期:2014-05-16  浏览次数:20351 次

菜鸟跪求高手大仙给看一下,谢谢。
请问大仙我的这段代码为何点击三次“显示”按钮才会成功执行。谢谢!


<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script src="http://libs.baidu.com/jquery/1.8.3/jquery.js"></script>

<title>无标题文档</title>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
</style>


</head>

<body>

  <input type="text" placeholder="你好" />
  <input type="password" placeholder="大家好" />
  <textarea rows="8" cols="10" placeholder="为什么"></textarea>

  <input id="btn" type="button" value="显示" />

  <div id="xxx" style="display: none; " >
    <form>
  <input type="password" placeholder="各位好1" />
  <input type="password" placeholder="各位好2" />
  <input type="password" placeholder="各位好3" />
</form>
  </div>

  <div>123456789</div>
</body>
</html>
<script type="text/javascript">
  $("#btn").click(function(){
    $("#xxx").show(0,jQuery.placeholder.shim());
});

(function($) {
  // @todo Document this.
  $.extend($,{ placeholder: {
      browser_supported: function() {
        if(($.browser.msie && ($.browser.version="10.0")) || ($.browser.opera))
        {
          return false;
        } 

        return this._supported !== undefined ?
          this._supported :
          ( this._supported = !!('placeholder' in $('<input type="text">')[0]) );

      },
      shim: function(opts) {
        var config = {
          color: '#f00', //595757
          cls: 'placeholder',
          selector: 'input[placeholder], textarea[placeholder]'
        };
        $.extend(config,opts);
        return !this.browser_supported() && $(config.selector)._placeholder_shim(config);
      }
  }});

  $.extend($.fn,{
    _placeholder_shim: function(config) {
      function calcPositionCss(target)
      {
        var op = $(target).offsetParent().offset();
    &n