Window.location.hash page jump, accurate positioning, examples show:
(1), index.phtml, page for reference
<ScriptID= "Bb_list_template"type= "Text/x-dot-template"><a title="Click to view baby details"href="<?php echo app_web_index_root?>/item/itemdetail<?php echo html_type;? >?qntag=1#iid=<%=it.num_iid%>&&state=<%=it.status%>&&page=<%=it.page%> "ID="title_<%=it.num_iid%>"><%=It.title%></a></Script>
(2), index.js, to get the parameter
/**
*window.location.hash definition and usage
*location is a built-in object that manages the address bar inside JavaScript.
* For example, location.href the URL of the management page, with Location.href=url you can directly redirect the page URL. The
* and Location.hash can be used to get or set the label value of the page. such as http://domain/#admin的location. hash= "#admin". The
*
*substr defines and uses the
*substr () method to extract a specified number of characters from the start subscript in a string.
* Syntax Stringobject.substr (start,length)
*start required. The starting subscript for the substring to extract. Must be numeric. If it is a negative number, the argument declares the position from the end of the string.
* That is,-1 refers to the last character in the string, 2 refers to the second-lowest character, and so on. The
*length is optional. The number of characters in the substring. Must be numeric. If this argument is omitted, then the string from the beginning of the stringobject to the end is returned.
*/
var Shash = window.location.hash.substr (1), var params = shash.split (' & '), var map = new HashMap (); for (var i in params) {var p = params[i].split ("="), if (p.length = = 2) {map.put (p[0], p[1]);}} Num_iid = Map.get (' iid ');d etailstate = map.get (' state '); if (detailstate = = ' Chuc ' | | detailstate = ' Chus ' | | detailstate = = ' Cangk ' | | Detailstate = = ' Shouw ') {$ (' #deatailback '). Show (); page = map.get (' page ');
(3), return button for positioning
<a class= "sui-btn btn-bordered btn-primary" style= "Display:none ()" id= "Deatailback" href= "Javascript:bblist ()" > Back home </a>/*** [bblist Jump Home]*/function bblist () {document.location.href = App_web_index_root_cdn + ' INDEX ' + HTML _type + '? qntag=1#detailstate= ' + detailstate + ' &page= ' + page + ' &itemid= ' + num_iid;}
Window.location.hash page jump, accurate positioning, examples show: