URL重定向Javascript
这个问题在这里已经有了答案:
使用location.href
window.location.href = email;
window.location.href = email;
应该将用户重定向到email
包含的URL
你可以设置window.location.href:
function enter()
{
var keepGoing = true;
var email;
while(keepGoing){
keepGoing = false
email = prompt("Please Enter Website Address");
// Website Address validation to see if it has http://
if(email.indexOf('http://') != 0)
{
alert("Not valid Web Address");
keepGoing = true;
}
//if nothing was entered
else if(email == '')
{
var email = prompt("Please Enter Valid Web Address");
}
else
{
window.location.href=email;
}
}
}
链接地址: http://www.djcxy.com/p/1951.html