
一个小jquery程序 大家帮忙修改一下
<html><head><scriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min....
<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">中 谢谢! 展开
<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个回答
展开全部
$(function(){
var chzn = $("#chzn-select");
chzn.change(function() {
var obj=$(this).val();
$("#show").html(obj);
});
$("#show").html(chzn.val());
})
var chzn = $("#chzn-select");
chzn.change(function() {
var obj=$(this).val();
$("#show").html(obj);
});
$("#show").html(chzn.val());
})
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询