URL 주소가 해시 (#) 인 페이지가 있습니다. localhost : 15164/L3/mobile/# Android/Alcateljquery를 사용하는 URL에서 해시 (#)를 가져와 페이지로드시 사용합니다.
jquery로 URL 주소를 가져오고 코드로드 이벤트에서 코드 뒤에 사용하고 싶습니다.
<head runat="server">
<title></title>
<script src="js/jquery1.8.2.js"></script>
<script>
$(document).ready(function() {
var url = window.location.href;
var rest = url.substring(url.lastIndexOf("#") + 1, url.length);
$('#urlLable').text(rest);
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="urlLable" runat="server" Text="Label"></asp:Label>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
페이지로드는 (JQuery와에서 주소를 얻을 수) :
protected void Page_Load(object sender, EventArgs e)
{
urlLable.DataBind();
string urlStr = urlLable.Text;
Response.Write(urlStr);
}
가능한 중복 아웃 앵커를 구문 분석하는 가장 쉬운 방법은 무엇입니까 현재 페이지의 위치?] (http://stackoverflow.com/questions/693844/whats-the-easiest-way-to-parse-the-anchor-out-of-the-current-pages-location) –