<select name=s>
<OPTION value=1 selected>1月</OPTION>
<OPTION value=2>2月</OPTION>
<OPTION value=3>3月</OPTION>
</select>
<select name=c>
<OPTION value=1 selected>1日</OPTION>
<OPTION value=2>2日</OPTION>
<OPTION value=3>3日</OPTION></select>
<input type="submit" name="button" id="button" value="查看" />能不能这样设置,自己手工制作弹出来的地址~
1月1日 弹出网址 123.html
1月2日 弹出网址 sdfsdfs.html这样的,我要弹出来的网页地址固定了,只能这样手工添加
<OPTION value=1 selected>1月</OPTION>
<OPTION value=2>2月</OPTION>
<OPTION value=3>3月</OPTION>
</select>
<select name=c>
<OPTION value=1 selected>1日</OPTION>
<OPTION value=2>2日</OPTION>
<OPTION value=3>3日</OPTION></select>
<input type="submit" name="button" id="button" value="查看" />能不能这样设置,自己手工制作弹出来的地址~
1月1日 弹出网址 123.html
1月2日 弹出网址 sdfsdfs.html这样的,我要弹出来的网页地址固定了,只能这样手工添加
<OPTION value=1 selected>1月</OPTION>
<OPTION value=2>2月</OPTION>
<OPTION value=3>3月</OPTION>
</select>
<select id="c">
<OPTION value="123.html" selected>1日</OPTION>
<OPTION value="456.html">2日</OPTION>
<OPTION value="789.html">3日</OPTION>
</select>
<input type="submit" name="button" id="button" value="查看" onclick="jump();" />
<script type="text/javascript">
function jump(){
window.location = document.getElementById("c").value;
}
</script>
也可以用value和一个url数组映射
var month = [1,2,3,4,5,6,7,8,9,10,11,12]; //这个可有可无
var days = [1,2,3,4,5,6,7,8,9,10...]; //同上
var urls = [["1.1.html","1.2.html","1.3.html..."],["2.1.html","2.2.html"...][....]];
getElementById("button").onclick=function() {
var para1 = document.getElementById("s").selectedIndex; //这里你用的是name,最好用id。方便
var para2 = document.getElementById("c").selectedIndex;
//如果没有那2个数组的话
alert(urls[para1][para2]);
};
有错吗,运行不起来
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>文档</title>
</head>
<script type="text/javascript">
var s = [1,2,3,4,5,6,7,8,9,10]; //这个可有可无
var c = [1,2,3,4,5,6,7,8,9,10]; //同上
var urls = [["1.1.html","1.2.html","1.3.html..."],["2.1.html","2.2.html"]];
getElementById("button").onclick=function() {
var para1 = document.getElementById("s").selectedIndex;
var para2 = document.getElementById("c").selectedIndex;
alert(urls[para1][para2]);
};
</script>
<body>
<select name="s" id="s">
<OPTION value=1 selected>1月</OPTION>
<OPTION value=2>2月</OPTION>
<OPTION value=3>3月</OPTION>
</select>
<select name="c" id="c">
<OPTION value=1 selected>1日</OPTION>
<OPTION value=2>2日</OPTION>
<OPTION value=3>3日</OPTION>
</select>
<input type="submit" name="button" id="button" value="查看" /></body>
</html>有错吗,运行不起来
<OPTION value=1 selected>1月</OPTION>
<OPTION value=2>2月</OPTION>
<OPTION value=3>3月</OPTION>
</select>
<select id="c">
<OPTION value="123.html" selected>1日</OPTION>
<OPTION value="456.html">2日</OPTION>
<OPTION value="789.html">3日</OPTION>
</select>
<input type="submit" name="button" id="button" value="查看" onclick="jump();" />
<script type="text/javascript">
function jump(){
window.location = document.getElementById("s").value + document.getElementById("c").value;
}
</script>
var para1 = document.getElementById("s").selectedIndex;
var para2 = document.getElementById("c").selectedIndex;
alert(urls[para1][para2]);
};
改成window.onload = function(){
getElementById("button").onclick=function() {
var para1 = document.getElementById("s").selectedIndex;
var para2 = document.getElementById("c").selectedIndex;
alert(urls[para1][para2]);
};
};
try
document.getElementById("button").onclick=function() {
或者试试#10的
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>文档</title>
</head>
<script type="text/javascript">
var s = [1,2,3,4,5,6,7,8,9,10]; //这个可有可无
var c = [1,2,3,4,5,6,7,8,9,10]; //同上
var urls = [["1.1.html","1.2.html","1.3.html..."],["2.1.html","2.2.html"]];
window.onload = function(){
document.getElementById("button").onclick=function() {
var para1 = document.getElementById("s").selectedIndex;
var para2 = document.getElementById("c").selectedIndex;
alert(urls[para1][para2]);
};
};
</script>
<body>
<select name="s" id="s">
<OPTION value=1 selected>1月</OPTION>
<OPTION value=2>2月</OPTION>
<OPTION value=3>3月</OPTION>
</select>
<select name="c" id="c">
<OPTION value=1 selected>1日</OPTION>
<OPTION value=2>2日</OPTION>
<OPTION value=3>3日</OPTION>
</select>
<input type="submit" name="button" id="button" value="查看" /></body>
</html>