欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js實(shí)現(xiàn)select跳轉(zhuǎn)功能代碼

 更新時(shí)間:2014年10月22日 17:04:44   投稿:whsnow  
實(shí)現(xiàn)select跳轉(zhuǎn)的方法有很多,本例為大家介紹的是js實(shí)現(xiàn)的,通過location.href獲取跳轉(zhuǎn)地址,需要的朋友可以看看

js簡(jiǎn)單實(shí)現(xiàn)select跳轉(zhuǎn)功能:代碼如下

<!DOCTYPE html> 
<html> 
<head> 
<title></title> 

</head> 
<body> 
<div class="selectBox"> 
<select class="toSlt"> 
<option >全部分類的商品</option> 
<option >普通車床</option> 
<option >回轉(zhuǎn)車床</option> 
<option >普通車床</option> 
<option >回轉(zhuǎn)車床</option> 
</select> 
</div> 
<script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script> 
<script type="text/javascript"> 

$(function(){ 
var $body = $('body'); 
$body.on('change', 'select:has(option[href])', function(e) { 
var _this = $(this), 
_href = _this.find('option:selected').attr('href');//獲取要跳轉(zhuǎn)的地址 
location.href = _href; //跳轉(zhuǎn) 
}) 
}) 

</script> 
</body> 
</html> 

相關(guān)文章

最新評(píng)論