我要做的是:比如点上海1时,打开baidu.com
点上海2时,打开sohu.com
点天津1时,打开163.com
等,我的代码如下。麻烦达人看下,最近在学习JSP,有点小白。急啊。<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<HEAD>
<script language="javascript">
<!--
var where = new Array(36);
function comefrom(loca,locacity) { this.loca = loca; this.locacity = locacity; }
where[0]= new comefrom("请选择地区","请选择基层法院");
where[1] = new comefrom("上海","|上海1|上海2|上海3");
where[2] = new comefrom("天津","|天津1|天津2|天津3");
function select() {
with(document.creator.province) { var loca2 = options[selectedIndex].value; }
for(i = 0;i < where.length;i ++) {
if (where[i].loca == loca2) {
loca3 = (where[i].locacity).split("|");
for(j = 0;j < loca3.length;j++) { with(document.creator.city) { length = loca3.length;
options[j].text = loca3[j]; options[j].value = loca3[j]; var
loca4=options[selectedIndex].value;}}
break;
}}
document.creator.address.value=loca2+loca4;
}
function init() {
with(document.creator.province) {
length = where.length;
for(k=0;k<where.length;k++) { options[k].text = where[k].loca; options[k].value =
where[k].loca; }
options[selectedIndex].text = where[0].loca; options[selectedIndex].value = where[0].loca;
}
with(document.creator.city) {
loca3 = (where[0].locacity).split("|");
length = loca3.length;
for(l=0;l<length;l++) { options[l].text = loca3[l]; options[l].value = loca3[l]; }
options[selectedIndex].text = loca3[0]; options[selectedIndex].value = loca3[0];
}}
-->
</script>
</head>
<BODY onload="init();">
<form name="creator" action=zc21.asp method=post onSubmit="return checkReg()">
<select name="province" onChange="select()"></select>
<select name="city" style="width:100" onchange="openla(this)"> </select>
</form>
</body>
</html>
<script>
function openla(obj){
alert(obj.value+"===");
window.open(obj.value);
}
</script>
点上海2时,打开sohu.com
点天津1时,打开163.com
等,我的代码如下。麻烦达人看下,最近在学习JSP,有点小白。急啊。<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<HEAD>
<script language="javascript">
<!--
var where = new Array(36);
function comefrom(loca,locacity) { this.loca = loca; this.locacity = locacity; }
where[0]= new comefrom("请选择地区","请选择基层法院");
where[1] = new comefrom("上海","|上海1|上海2|上海3");
where[2] = new comefrom("天津","|天津1|天津2|天津3");
function select() {
with(document.creator.province) { var loca2 = options[selectedIndex].value; }
for(i = 0;i < where.length;i ++) {
if (where[i].loca == loca2) {
loca3 = (where[i].locacity).split("|");
for(j = 0;j < loca3.length;j++) { with(document.creator.city) { length = loca3.length;
options[j].text = loca3[j]; options[j].value = loca3[j]; var
loca4=options[selectedIndex].value;}}
break;
}}
document.creator.address.value=loca2+loca4;
}
function init() {
with(document.creator.province) {
length = where.length;
for(k=0;k<where.length;k++) { options[k].text = where[k].loca; options[k].value =
where[k].loca; }
options[selectedIndex].text = where[0].loca; options[selectedIndex].value = where[0].loca;
}
with(document.creator.city) {
loca3 = (where[0].locacity).split("|");
length = loca3.length;
for(l=0;l<length;l++) { options[l].text = loca3[l]; options[l].value = loca3[l]; }
options[selectedIndex].text = loca3[0]; options[selectedIndex].value = loca3[0];
}}
-->
</script>
</head>
<BODY onload="init();">
<form name="creator" action=zc21.asp method=post onSubmit="return checkReg()">
<select name="province" onChange="select()"></select>
<select name="city" style="width:100" onchange="openla(this)"> </select>
</form>
</body>
</html>
<script>
function openla(obj){
alert(obj.value+"===");
window.open(obj.value);
}
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货