【问题标题】:Trigger javascript function with anchor from another page使用来自另一个页面的锚点触发 javascript 函数
【发布时间】:2011-04-05 00:33:39
【问题描述】:

有没有办法通过像<a href="www.sample.com/page.html#reference" class="links">这样的锚链接从另一个页面触发<a href="javascript:switch_tabs('tab3');">?

做过类似的事情

如果(window.location.hash == '#abstract'){ $(文档).ready(函数() { switch_tabs('tab1'); }); } 如果(window.location.hash == '#full'){ $(文档).ready(函数() { switch_tabs('tab2'); }); } 如果(window.location.hash == '#reference'){ $(文档).ready(函数() { switch_tabs('tab3'); }); }

如果有人想让它更漂亮,请成为我的客人。

谢谢

【问题讨论】:

  • 只有在 page.html 中有脚本来捕获 location.hash 并为您触发时
  • 感谢设法用 location.hash 做一些事情,感谢帮助。

标签: javascript triggers anchor


【解决方案1】:

没有。您需要获取脚本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-02-18
    • 1970-01-01
    • 2014-03-03
    • 2011-03-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多