你试试下面的例子:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>进入链接</title>
</head><body>
<script language=javascript>
if (window.confirm('进入链接吗?')==true)
{
window.location.href='http://www.microsoft.com';
}
</script></body></html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>进入链接</title>
</head><body>
<script language=javascript>
if (window.confirm('进入链接吗?')==true)
{
window.location.href='http://www.microsoft.com';
}
</script></body></html>
<a href="#" onclick="if(confirm('确定进入该链接?')window.location.href='http://www.csdn.net/'">链接</a>