<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
window.οnlοad=function getMsg()
{
url=window.location.href;//获取当前地址
with(document)
{
write("地址的协议:"+location.protocol+"<br>");//输出地址协议
write("地址的主机名:"+location.hostname+"<br>");//输出主机名
write("地址的主机和端口号:"+location.host+"<br>");//输出主机和端口号
write("取得路径名:"+location.pathname+"<br>");//输出路径名
write("取得整个地址:"+url+"<br>");//输出整个地址
}
}
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
window.οnlοad=function getMsg()
{
url=window.location.href;//获取当前地址
with(document)
{
write("地址的协议:"+location.protocol+"<br>");//输出地址协议
write("地址的主机名:"+location.hostname+"<br>");//输出主机名
write("地址的主机和端口号:"+location.host+"<br>");//输出主机和端口号
write("取得路径名:"+location.pathname+"<br>");//输出路径名
write("取得整个地址:"+url+"<br>");//输出整个地址
}
}
</script>
</head>
<body>
</body>
</html>