javascript
javascript:jquery.history.js使用方法
step1:download jquery.history.js
step2:create a test page as following:
說明:當(dāng)頁(yè)面執(zhí)行javascript代碼后,地址欄能前進(jìn)和后退。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
#mydiv
{
border: 1px solid blue;
width: 400px;
height: 200px;
}
</style>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.history.js" type="text/javascript"></script>
<script type="text/javascript">
function showMsg(msg) {//you can ajax request
$('#mydiv').html(msg);
}
$(function () {
$("#link1").bind("click", function () { window.location.hash = "#link1"; });
$("#link2").bind("click", function () { ?window.location.hash = "#link2"; });
$("#link3").bind("click", function () { ?window.location.hash = "#link3"; });
$.history.init(function (hash) {
var msg;
if (hash) {
msg= hash;
}?
else?
{
msg= "no set hash value"
}
showMsg(msg);
});
})
</script>
</head>
<body>
<input type="button" value="button1" id="link1" />
<input type="button" value="button2" id="link2" />
<input type="button" value="button3" id="link3" />
<hr />
<div id="mydiv">
</div>
?
?
</body>
</html>
posted on 2010-12-09 16:44 庹林 閱讀(...) 評(píng)論(...) 編輯 收藏轉(zhuǎn)載于:https://www.cnblogs.com/tuolin/archive/2010/12/09/1901439.html
總結(jié)
以上是生活随笔為你收集整理的javascript:jquery.history.js使用方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Sharepoint 自定义字段类型
- 下一篇: 我也来说说Dynamic