我试图使用Javascript函数将用户发送到另一个页面:
<input type="button" name="confirm" value="nextpage" onClick="message()">
Run Code Online (Sandbox Code Playgroud)
我的JavaScript:
function message() {
ConfirmStatus = confirm("Install a Virus?");
if (ConfirmStatus == true) {
//Send user to another page
}
}
Run Code Online (Sandbox Code Playgroud)
有谁知道如何将用户发送到另一个特定页面?
Jos*_*eal 20
你的代码搞砸了,但是如果我做对了你可以使用以下内容:
location.href = 'http://www.google.com';
or
location.href = 'myrelativepage.php';
Run Code Online (Sandbox Code Playgroud)
祝好运!
但我必须对你说,
其他选项是通过代码执行此操作:
PHP: header('Location: index.php');
C#: Response.Redirect("yourpage.aspx");
Java的: response.sendRedirect("http://www.google.com");
注意: