1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > html下拉列表框跳转 html下拉框跳转问题

html下拉列表框跳转 html下拉框跳转问题

时间:2022-06-14 09:22:56

相关推荐

html下拉列表框跳转 html下拉框跳转问题

满意答案

mensa投资

.10.27

采纳率:57%等级:5

已帮助:304人

两个下拉框,第一个里面有A,B两个选项,第二个里面有X,Y两个选项。后面有一个按钮。怎么做到选A和X时候点击按钮跳转1.html。选择A和Y的时候跳转2.html。选择B和X跳转3.html。选择B和Y跳转4.html。()

代码如下:

TEST

function openPage(){

var str1 = document.getElementById("set1").value;

var str2 = document.getElementById("set2").value;

if (str1 == 0 && str2 == 0){

window.location.href='A.html';

}

if (str1 == 0 && str2 == 1){

window.location.href='B.html';

}

if (str1 == 1 && str2 == 0){

window.location.href='C.html';

}

if (str1 == 1 && str2 == 1){

window.location.href='D.html';

}

}

自己在写有上面代码的html文件的同一个目录下添加ABCD四个html文件

00分享举报

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。