【发布时间】:2015-05-05 18:14:33
【问题描述】:
我在 HTML/JS 中有这段代码:
<a href="#customer_tickets" class="tabLink" onclick="LoadPage('/customer/editcustomer_tickets.php?customer=<?php echo $customer["sequence"]; ?>', '.EditCustomer');">Tickets</a>
if(location.hash) {
//load the set hash here
}
点击a href时,会运行JS中的LoadPage函数将页面加载到div中
当它们被点击时,它会在浏览器的 URL 中设置哈希位置
我希望能够检查页面加载时是否设置了哈希位置,如果是,则自动单击正确的 a href
我该怎么做?
【问题讨论】:
-
如果 location.hash 为真,为什么不尝试将页面加载到 div 中?
标签: javascript jquery