Skip to content

Instantly share code, notes, and snippets.

@howie50417
Last active December 21, 2017 04:55
Show Gist options
  • Save howie50417/6ee7b87fd2790bd5d964697c2882096d to your computer and use it in GitHub Desktop.
Save howie50417/6ee7b87fd2790bd5d964697c2882096d to your computer and use it in GitHub Desktop.
p1.html
<a href="breast-new-tuba.htm"><img src="img/18/yes-18.png" class="img-responsive center-block"></a>
改成
<a id="breast-new-tuba"><img src="img/18/yes-18.png" class="img-responsive center-block"></a>
然後加上
<script>
$(document).ready(function() {
$("#breast-new-tuba").click(function(){
localStorage.agree_18r = true;
window.location = "breast-new-tuba.htm";
});
});
</script>
然後在需要18r才可進入的網頁加上
<script>
$(document).ready(function() {
if (localStorage.agree_18r != true){
window.location = "18alert-test.htm";
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment