<html>
<head>
<script type="text/javascript">
window.onload = function () {
var hostname = window.location.hostname;
var href = window.location.href;
var host = window.location.host;
var port = window.location.port;
var pathname = window.location.pathname;
var search = window.location.search;
var protocoal = window.location.protocol;
var _str = "hostname:" + hostname + "<br>";
_str += "href:" + href + "<br>";
_str += "host:" + host + "<br>";
_str += "port:" + port + "<br>";
_str += "pathname:" + pathname + "<br>";
_str += "search:" + search + "<br>";
_str += "protocoal:" + protocoal + "<br>";
var hostname = window.location.hostname;
var _host;
if (hostname.indexOf(".") > 0) {
_host = hostname.split(".")[0];
} else {
_host = hostname;
}
document.getElementById("tmpDiv").innerHTML = "host:" + _host + "<hr>" + _str;
}
</script>
</head>
<body>
<div id="tmpDiv" name="tmpDiv">
</div>
</body>
</html>
'JAVASCRIPT' 카테고리의 다른 글
jQuery 엔터키 이벤트 (0) | 2013.05.13 |
---|---|
jQuery 숫자 포멧 변경 (콤마..) (0) | 2013.05.06 |
숫자만 입력가능 (0) | 2013.04.03 |
[jQueryMobile] data-role="content" 높이 100%로 채우기 (0) | 2012.11.13 |
[jQueryMobile] header,footer 사라지지(toggle) 않게 고정 시키기 (0) | 2012.11.13 |