<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>location</title>
</head>
<script type="text/javascript">
function location(){
document.write(window.location.href);
}
</script>
<body>
<form>
<input type="button" value="点击获取输出显示文档的URL" onclick="location()">
</form>
</body>
</html>
方法名称不用关键词 就能正常运行了
你把方法名字换一下,最好不是什么关键词就好了