js动态设置链接地址

2025-02-26 11:09:55
推荐回答(2个)
回答1:

怎么动态法?
注册
这样?
---------------------------------
注册

js里写个gotopage函数,例如:
function gotopage() {
if (condition1) window.location = "/1.html";
if (condition2) window.location = "/2.html";

最好具体说一下要什么条件,想要什么表现形式。不同的条件实现方法也不一样。另外如果你要跳转1,2两个页面的话,Registe这个页面又用来干嘛呢?

回答2:

楼主要满足什么条件呢,条件不同,可能js也不同,大体如下
if(条件){
window.location.href="1.html";
}
if(条件2){
widow.location.href="2.html";
}