<a href="http://www.google.com" onclick=comfirmGo()>Go</a>function confirmRemove() {
var isGo= confirm("Are you sure you want to...?");
if(!isGo) {
// 这里怎样改变href的值链接到其他网址呢?
}
}麻烦知道的兄弟告知一声,感谢!
var isGo= confirm("Are you sure you want to...?");
if(!isGo) {
// 这里怎样改变href的值链接到其他网址呢?
}
}麻烦知道的兄弟告知一声,感谢!
var isGo = confirm("Are you sure you want to...?");
if (!isGo) {
// 这里怎样改变href的值链接到其他网址呢?
obj.href = "http://www.baidu.com";
}
}
实在想弄,看这样可以吗。加上一句window.location.href="网址";
var isGo= confirm("Are you sure you want to...?");
if(!isGo) {
obj.href="";
}
}
onclick=comfirmGo(this)
想到另一个问题,如果用户在confirm box选的是Cancel, 要求停留在当前页面,并且不刷新页面不修改原来href的值,应该怎么弄呢?obj.href = "?" ???
document.getElementById('a1').onclick = function(e){
if(!confirm('...')){
e.preventDefault();
return false;
}
}
<a href="http://www.google.com" onclick="return confirm('...')">Go</a>