2013-04-18 25 views
0

使用javascript我使用JavaScript函数跳转到一个div部分当前HTML页面上(system_details.html)不同的html页面的部分:导航到div的在HREF

<a href="javascript:show_processor()">Processor</a> 
<a href="javascript:show_ram()">RAM</a> 

不过,我想直接从不同的html页面导航到system_details.html页面的show_ram()函数(index.html)

+0

http://www.htmlgoodies.com/tutorials/getting_started/article.php/3479511/So-You-Want-A-Page-Jump-Huh.htm – Guy 2013-04-18 04:34:21

回答

-1

使用ajax概念。从index.html载入数据页面

0

给出链接和ID <a href="javascript:show_ram()" id="ram">RAM</a>。使用像这样的散列,在URL的末尾添加这个idindex.html#ram

然后使用jQuery做这样的事情:

$(document).ready(function(){ 
    if(window.location.hash) $('#' + window.location.hash).click(); 
}); 

这将需要在URL的最后一部分的散列为纽带的id后进行点击,然后调用click()链接与指定的id

+0

我已经更新了答案,因为我意识到我没有不能正确理解原始问题。 – 2013-04-22 03:32:55