📄 dom_obj_location.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML DOM Location Object</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>HTML DOM Location Object</h1>
<hr />
<h2>Location Object</h2>
<p>The Location object is actually a JavaScript object, not an HTML DOM object.</p>
<p>The Location object is
automatically created by the JavaScript runtime engine and contains information about the current URL. Example: <a target="_blank" href="../js/tryit.asp@filename=tryjs_location">Send
a user to a new location</a></p>
<p>The Location object is part of the Window object and is accessed through the
window.location property.</p>
<p><b>IE:</b> Internet Explorer, <b>F:</b> Firefox, <b>O:</b> Opera.</p>
<h3>Location Object Properties</h3>
<table class="ex" cellspacing="0" border="1" width="100%">
<tr>
<th width="25%" align="left">Property</th>
<th width="62%" align="left">Description</th>
<th width="5%" align="left">IE</th>
<th width="4%" align="left">F</th>
<th width="4%" align="left">O</th>
</tr>
<tr>
<td valign="top"><a href="prop_loc_hash.asp">hash</a></td>
<td valign="top">Sets or returns the URL from the hash sign (#)</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
</tr>
<tr>
<td valign="top"><a href="prop_loc_host.asp">host</a></td>
<td valign="top">Sets or returns the hostname and port number of the
current URL</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
</tr>
<tr>
<td valign="top"><a href="prop_loc_hostname.asp">hostname</a></td>
<td valign="top">Sets or returns the hostname of the current URL</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
</tr>
<tr>
<td valign="top"><a href="prop_loc_href.asp">href</a></td>
<td valign="top">Sets or returns the entire URL</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
</tr>
<tr>
<td valign="top"><a href="prop_loc_pathname.asp">pathname</a></td>
<td valign="top">Sets or returns the path of the current URL</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
</tr>
<tr>
<td valign="top"><a href="prop_loc_port.asp">port</a></td>
<td valign="top">Sets or returns the port number of the current URL</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
</tr>
<tr>
<td valign="top"><a href="prop_loc_protocol.asp">protocol</a></td>
<td valign="top">Sets or returns the protocol of the current URL</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
</tr>
<tr>
<td valign="top"><a href="prop_loc_search.asp">search</a></td>
<td valign="top">Sets or returns the URL from
the question mark (?)</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
</tr>
</table>
<h3>Location Object Methods</h3>
<table class="ex" cellspacing="0" border="1" width="100%">
<tr>
<th width="25%" align="left" valign="top">Method</th>
<th width="62%" align="left" valign="top">Description</th>
<th width="5%" align="left" valign="top">IE</th>
<th width="4%" align="left" valign="top">F</th>
<th width="4%" align="left" valign="top">O</th>
</tr>
<tr>
<td valign="top"><a href="met_loc_assign.asp">assign()</a></td>
<td valign="top">Loads a new document</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
</tr>
<tr>
<td valign="top"><a href="met_loc_reload.asp">reload()</a></td>
<td valign="top">Reloads the current document</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
</tr>
<tr>
<td valign="top"><a href="met_loc_replace.asp">replace()</a></td>
<td valign="top">Replaces the current document with a new one</td>
<td valign="top">4</td>
<td valign="top">1</td>
<td valign="top">9</td>
</tr>
</table>
<br />
<hr />
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -