는 Gmail의 URL은 다음과 같은 :
https://accounts.google.com/ServiceLogin?sacu=1&scc=1&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&osid=1&service=mail&ss=1<mpl=default&rm=false#identifier
때 비밀번호 :
https://accounts.google.com/ServiceLogin?sacu=1&scc=1&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&osid=1&service=mail&ss=1<mpl=default&rm=false#password
는 변화가 URL의 맨 끝 부분에만 해시 태그입니다 봐. 이제 어떻게 구현할 수 있을까요?
javascript에 "hashchange"라는 이벤트가 있습니다. 내가 생각을하지만 어떻게 내가 주소 입력란에이 해시 변화를 달성 할
<html>
<head>
<title>Text</title>
</head>
<body>
<div id="uname">
//username related code
<a href="#password"><div id="hello">Next</div></a>
</div>
<div id="password" style="display:none">
//username related code
<div id="final">Submit</div>
</div>
<script>
window.onload=function(){
window.addEventListener("hashchange", function(){ //this is the trick
console.log("Hash changed to", window.location.hash);
if(window.location.hash=="password")
//show password related div
else
//show username related div
});
}
</script>
</body>
:
이 한 번 봐? 서버에서 무엇을 보내야합니까? 편집 : 알겠습니다. 나는 그것을 읽었습니다. ^^ – nauti페이지의 첫 번째 URL : 다음 버튼을 클릭 한 후 something.com # uname (기본적으로 사용자 이름 영역이 표시됨)이 url을 something.com # password로 만들고 "hashchange"에서 이벤트를 처리합니다. 이벤트 리스너. –
잘 작동하지만, window.location.hash === "password"가 필요합니다. (# 참고) :) – nauti