菜鸟求助 html 中 怎么写这段 js代码
两个select一个input点击input按钮跳转到指定网页<selectname="01"><optionvalue="a">A</option><optionval...
两个select 一个 input 点击input按钮 跳转到指定网页
<select name="01">
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
<option value="d">D</option>
</select>
<select name="02">
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
</select>
<input type="submit" value="提交" />
如果选择 A 04,点击input按钮 跳转到 http://www.XXX.com/a_4.html
如果选择 B 03,点击input按钮 跳转到 http://www.XXX.com/b_3.html 展开
<select name="01">
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
<option value="d">D</option>
</select>
<select name="02">
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
</select>
<input type="submit" value="提交" />
如果选择 A 04,点击input按钮 跳转到 http://www.XXX.com/a_4.html
如果选择 B 03,点击input按钮 跳转到 http://www.XXX.com/b_3.html 展开
1个回答
展开全部
<!DOCTYPE html>
<html>
<head>
<title>演示</title>
<script type="text/javascript">
onload = function () {
var menuA = document.getElementById("menuA");
var menuB = document.getElementById("menuB");
document.getElementById("submit").onclick = function () {
location.href = "http://www.baidu.com/" + menuA.value + "_" + menuB.value + ".html";
};
};
</script>
</head>
<body>
<select name="01" id="menuA">
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
<option value="d">D</option>
</select>
<select name="02" id="menuB">
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
</select>
<input id="submit" type="submit" value="提交" />
</body>
</html>
<html>
<head>
<title>演示</title>
<script type="text/javascript">
onload = function () {
var menuA = document.getElementById("menuA");
var menuB = document.getElementById("menuB");
document.getElementById("submit").onclick = function () {
location.href = "http://www.baidu.com/" + menuA.value + "_" + menuB.value + ".html";
};
};
</script>
</head>
<body>
<select name="01" id="menuA">
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
<option value="d">D</option>
</select>
<select name="02" id="menuB">
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
</select>
<input id="submit" type="submit" value="提交" />
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询