怎么选择一个地域后让它自动弹跳到一个一个指定的链接去 求高手帮忙我改下
function Dsy() {
this.Items = {};
}
Dsy.prototype.add = function(id, iArray) {
this.Items[id] = iArray;
}
Dsy.prototype.Exists = function(id) {
if (typeof (this.Items[id]) == "undefined") return false;
return true;
}
function change(v) {
var str = "0";
for (i = 0; i < v; i++) { str += ("_" + (document.getElementById(s[i]).selectedIndex - 1)); };
var ss = document.getElementById(s[v]);
with (ss) {
length = 0;
options[0] = new Option(opt0[v], opt0[v]); if (v && document.getElementById(s[v - 1]).selectedIndex > 0 || !v) {
if (dsy.Exists(str)) {
ar = dsy.Items[str]; for (i = 0; i < ar.length; i++) {
if (v > 0)
options[length] = new Option(ar[i].split('|')[1], ar[i].split('|')[0]);
else
options[length] = new Option(ar[i], ar[i]);
}
if (v) options[1].selected = true;
}
}
if (++v < s.length) { change(v); }
}
}var dsy = new Dsy();dsy.add("0", ["北京", "天津", "河北", "内蒙古", "山东", "山西", "上海", "江苏", "安徽", "浙江", "广西", "广东", "福建", "海南", "河南", "湖北", "湖南", "江西", "黑龙江", "吉林", "辽宁", "新疆", "青海", "甘肃", "宁夏", "陕西", "四川", "云南", "贵州", "重庆", "深圳", "澳门", "西藏"]);
dsy.add("0_0", ["bj|北京"]);
dsy.add("0_1", ["tj|天津"]);
dsy.add("0_2", ["sjz|石家庄", "ts|唐山", "qhd|秦皇岛", "chengde|承德", "hd|邯郸", "xt|邢台", "zjk|张家口", "cangzhou|沧州", "lf|廊坊", "hs|衡水", "bd|保定", "zhangbei|张北"]);
dsy.add("0_3", ["hu|呼和浩特", "bt|包头", "wuhai|乌海", "chifeng|赤峰", "xl|锡林浩特", "erds|鄂尔多斯", "xam|兴安盟", "wlcb|乌兰察布", "tongliao|通辽", "hlbe|呼伦贝尔", "bycem|巴彦淖尔盟", "alsm|阿拉善盟"]);
var s = ["province", "city"];
var opt0 = ["请选择", "请选择"];
function setup() {
for (i = 0; i < s.length - 1; i++)
document.getElementById(s[i]).onchange = new Function("change(" + (i + 1) + ")");
change(0);
}
//--------调用--------------
function $(id) { return document.getElementById(id); }
function btnOk() {
if ($("city").value == "请选择") {
alert("请选择城市!");
}
else {
SetCookies($("city").value.split('|')[0]);
if ($("curpath")) {
window.location.href = 'http://' + $("city").value.split('|')[0] + '.58.com/' + $("curpath").value+'/';
}
else {
window.location.href = 'http://' + $("city").value.split('|')[0] + '.58.com/';
}
}
}//---------------取更新数据-------------
function subValue() {
var clientWin = document.getElementById("gsInfo").contentWindow;
clientWin.GetData(callback);}
function callback() {
var clientWin = document.getElementById("gsInfo").contentWindow; if (clientWin.xmlHttp.readyState == 4) {
//alert(clientWin.xmlHttp.status);
if (clientWin.xmlHttp.status == 200) {
var result = clientWin.xmlHttp.responseText;
//alert(result);
eval(result);
}
}
}
function Dsy() {
this.Items = {};
}
Dsy.prototype.add = function(id, iArray) {
this.Items[id] = iArray;
}
Dsy.prototype.Exists = function(id) {
if (typeof (this.Items[id]) == "undefined") return false;
return true;
}
function change(v) {
var str = "0";
for (i = 0; i < v; i++) { str += ("_" + (document.getElementById(s[i]).selectedIndex - 1)); };
var ss = document.getElementById(s[v]);
with (ss) {
length = 0;
options[0] = new Option(opt0[v], opt0[v]); if (v && document.getElementById(s[v - 1]).selectedIndex > 0 || !v) {
if (dsy.Exists(str)) {
ar = dsy.Items[str]; for (i = 0; i < ar.length; i++) {
if (v > 0)
options[length] = new Option(ar[i].split('|')[1], ar[i].split('|')[0]);
else
options[length] = new Option(ar[i], ar[i]);
}
if (v) options[1].selected = true;
}
}
if (++v < s.length) { change(v); }
}
}var dsy = new Dsy();dsy.add("0", ["北京", "天津", "河北", "内蒙古", "山东", "山西", "上海", "江苏", "安徽", "浙江", "广西", "广东", "福建", "海南", "河南", "湖北", "湖南", "江西", "黑龙江", "吉林", "辽宁", "新疆", "青海", "甘肃", "宁夏", "陕西", "四川", "云南", "贵州", "重庆", "深圳", "澳门", "西藏"]);
dsy.add("0_0", ["bj|北京"]);
dsy.add("0_1", ["tj|天津"]);
dsy.add("0_2", ["sjz|石家庄", "ts|唐山", "qhd|秦皇岛", "chengde|承德", "hd|邯郸", "xt|邢台", "zjk|张家口", "cangzhou|沧州", "lf|廊坊", "hs|衡水", "bd|保定", "zhangbei|张北"]);
dsy.add("0_3", ["hu|呼和浩特", "bt|包头", "wuhai|乌海", "chifeng|赤峰", "xl|锡林浩特", "erds|鄂尔多斯", "xam|兴安盟", "wlcb|乌兰察布", "tongliao|通辽", "hlbe|呼伦贝尔", "bycem|巴彦淖尔盟", "alsm|阿拉善盟"]);
var s = ["province", "city"];
var opt0 = ["请选择", "请选择"];
function setup() {
for (i = 0; i < s.length - 1; i++)
document.getElementById(s[i]).onchange = new Function("change(" + (i + 1) + ")");
change(0);
}
//--------调用--------------
function $(id) { return document.getElementById(id); }
function btnOk() {
if ($("city").value == "请选择") {
alert("请选择城市!");
}
else {
SetCookies($("city").value.split('|')[0]);
if ($("curpath")) {
window.location.href = 'http://' + $("city").value.split('|')[0] + '.58.com/' + $("curpath").value+'/';
}
else {
window.location.href = 'http://' + $("city").value.split('|')[0] + '.58.com/';
}
}
}//---------------取更新数据-------------
function subValue() {
var clientWin = document.getElementById("gsInfo").contentWindow;
clientWin.GetData(callback);}
function callback() {
var clientWin = document.getElementById("gsInfo").contentWindow; if (clientWin.xmlHttp.readyState == 4) {
//alert(clientWin.xmlHttp.status);
if (clientWin.xmlHttp.status == 200) {
var result = clientWin.xmlHttp.responseText;
//alert(result);
eval(result);
}
}
}
你发错地方了