hostnameプロパティ Javaスクリプトのプロパティ indexプロパティ

hrefプロパティ

hrefプロパティは完全なURL名です。

シンタックス

	
	
	objectName.href
	
	

オブジェクト

	
	
	<script>
	
	document.write("例1: " + location.hash + "<p>");
	document.write("例2: " + location.host + "<p>");
	document.write("例3: " + location.hostname + "<p>");
	document.write("例4: " + location.href + "<p>");
	document.write("例5: " + location.pathname + "<p>");
	document.write("例6: " + location.port + "<p>");
	document.write("例7: " + location.protocol + "<p>");
	document.write("例8: " + location.search + "<p>");
	document.write("例9: " + location.target);
	
	</script>
	
	

上記のhrefプロパティを使った例は、locationプロパティを使った次の例と同じ意味になります。

	
	
	<script>
	
	document.write(document.location);
	
	</script>
	
	

関連したプロパティ



Copyright (C) 1996-2003 by Yasukazu Yokoi. All Rights Reserved.