javascript获取host

document.writeln(location.protocol);
document.writeln(location.origin);  //包括端口号
document.writeln(location.host);    //不包括端口号
document.writeln(location.port);         //默认为80的就为空
document.writeln(location.pathname);
 
<a href="<%=location.origin%>/membership/member/detail?member_id=<%= item.member_id %>">
posted @ 2016-04-12 14:45  yanying12138  阅读(1521)  评论(0编辑  收藏  举报