html下拉框跳轉問題怎麼弄?
- 2022-09-04
兩個下拉框,第一個裡面有A,B兩個選項,第二個裡面有X,Y兩個選項。後面有一個按鈕。怎麼做到選A和X時候點選按鈕跳轉1。html。選擇A和Y的時候跳轉2。html。選擇B和X跳轉3。html。選擇B和Y跳轉4。html。
程式碼如下:
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檔案
上一篇:能把下面的這段話翻譯成英文嗎?
下一篇:美學原理 自然美