0

I am trying to make a html page with multiple divs that will be shown when certain links are clicked. Here is an example

Home page: page 1, page 2

When i click page 1 it goes to.. Page 1:

Page3, Home

when i click home it goes to.. home page:

page 1,page 2

However when i then click page 1 or page 2 nothing happens and it stays on the same div. is there a script to not only show different divs on click but keep the loop going forever?

thanks.

code below

var $prehashval = "";
function loop()
{
if (location.hash.slice(1)!=$prehashval)
    hashChanged();

$prehashval = location.hash.slice(1);
setTimeout("loop()");
}
function hashChanged()
{
var $output;
switch (location.hash.slice(1))

 {
     default:
        $output = location.hash.slice(1);
}
}
 loop(); 
4

1 に答える 1

0

Javascript + HTML5? タグを非表示/表示するために使用できる「hidden」プロパティがあります。ここを見てください: HTML5 グローバル属性

または、関数 hide/show および hidden プロパティで JQuery を使用します。

于 2012-07-13T10:32:51.530 に答える