<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src=‘js/jquery.min.js‘></script>
</head>
<body>
<select name="" id=‘selectId‘>
<option value="0">--请选择--</option>
<option value="1">a</option>
<option value="2">b</option>
<option value="3">c</option>
</select>
<script>
$(function (){
$(‘#selectId‘).on(‘change‘,function(){
var selectId = $(‘#selectId option:selected‘);
if(selectId.val()==1){
window.open(‘pink.html‘);
}else if(selectId.val()==2){
window.open(‘blue.html‘);
}else if(selectId.val()==3){
window.open("green.html");
})
});
</script>
</body>
</html>
window.open();是jquery中用来打开链接的地址。pink.html、blue.html、green.html这些是要跳转到的页面。
时间: 2024-10-13 22:17:10