pathname属性.html

来自「即学即用JavaScript核心对象参考手册原版光盘」· HTML 代码 · 共 34 行

HTML
34
字号
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
 <table align="center" border="1" bordercolor="#009900" style="border-collapse:collapse">
    <script>
       with(document)
	   {   
	      writeTable("属性","属性值");
		  writeTable("URL",location.href);
		  writeTable("host",location.host);
		  writeTable("hostname",location.hostname);
		  writeTable("port",location.port);
		  writeTable("pathname",location.pathname);
		  writeTable("protocol",location.protocol);
	   }
	   function writeTable(str1,str2)
	   {
	      with (document)
		  {
		     write("<tr>");
			 write("<td>");write(str1);write("</td>");
			 write("<td>");write(str2);write("</td>");
			 write("</tr>");
		  }
		  
	   }
   </script>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?