按shift不好,这样会打开新窗口,这里按ctrl来<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script>
function getIt(){
if (event.ctrlKey)
window.open("link1");
else
window.open("link2");
}
</script>
</head><body>
<a href="javascript:void(0)" onClick="getIt()">GET IT</a>
</body>
</html>
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script>
function getIt(){
if (event.ctrlKey)
window.open("link1");
else
window.open("link2");
}
</script>
</head><body>
<a href="javascript:void(0)" onClick="getIt()">GET IT</a>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title><script language="javascript">function getIt()
{
if (event.ctrlKey)
{
window.open("1.jsp");
}
else
{
window.open("2.jsp");
}
}</script></head><body>
<form method="post">
<a href="javascript:void(0)" onClick="getIt()">GET IT</a>
</form>
</body>
</html>
对一个指定的表达式进行求值而不返回任何值!也就是在这里它什么也不做
但void有一个防止错误返回的作用