<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript"> 
$(function(){$(".chzn-select").change(function() {
   var obj=$(this).val();
   $("#show").html(obj);
   });
           })
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" href="chosen/chosen.css" />
</head>
<body>
<div style=" margin-top:50px; width:1000px;">
  <form>
    <select  class="chzn-select" id="chzn-select" style="width:350px;">
      <option value="新闻">新闻</option>
      <option value="娱乐">娱乐</option>
      <option value="体育">体育</option>
    </select>
  </form>
</div>
<div style="border:#093 1px solid; height:20px; margin-top:100px; width:350px;" id="show"></div>
</body>
</html>问题:怎样在默认的情况下"新闻"选项出现在<div id="show">中 谢谢!

解决方案 »

  1.   


    <html>
    <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript"> 
    $(function(){$(".chzn-select").change(function() {
    var obj=$(this).val();
    $("#show").html(obj);
    });
      })
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link rel="stylesheet" href="chosen/chosen.css" />
    </head>
    <body>
    <div style=" margin-top:50px; width:1000px;">
      <form>
      <select class="chzn-select" id="chzn-select" style="width:350px;">
      <option value="新闻">新闻</option>
      <option value="娱乐">娱乐</option>
      <option value="体育">体育</option>
      </select>
      </form>
    </div>
    <div style="border:#093 1px solid; height:20px; margin-top:100px; width:350px;" id="show"></div>
    <script type="text/javascript"> 
    $("#show").html("新闻");
    </script>
    </body>
    </html>
      

  2.   

    <div style="border:#093 1px solid; height:20px; margin-top:100px; width:350px;" id="show"></div>
    <script type="text/javascript"> 
    $("#show").html("新闻");
    </script>
    -----------------------------------------------------------------------------------
    <div style="border:#093 1px solid; height:20px; margin-top:100px; width:350px;" id="show">新闻</div>这样岂不更简单?
      

  3.   

    已经有人帮忙解决$(function(){
    var chzn = $("#chzn-select");
    chzn.change(function() {
    var obj=$(this).val();
    $("#show").html(obj);
    });

    $("#show").html(chzn.val());
    }) </script>