有人能帮我做以下事情吗?
我有一个导航栏,例如:
Step_1.html-Step_2.html-Step_3.html-Step_4.html
我想禁用接下来两个步骤ie3和4的链接。
然后,当他们进入步骤2时,只有步骤4被禁用。
(但问题是,当我说Step_4.html并想回到Step_2.html时,我希望能够直接点击回到Step_4.html,因为我已经完成了所有步骤,所以我希望现在不要在导航栏中禁用它)
如果可能的话,我只想使用java脚本!
第1页如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="sessvars.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>p4</title>
</head>
<body>
<p>Page 1</p>
<p><a href="p2.html">Page 2</a></p>
<p>Page 3</p>
<p>Page 4</p>
</body>
</html>
类似的第2页
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="sessvars.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>p4</title>
</head>
<body>
<p><a href="p1.html">Page 1</a></p>
<p>Page 2</p>
<p><a href="p3.html">Page 3</a></p>
<p>Page 4</p>
</body>
</html>
第3页,像这个
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="sessvars.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>p4</title>
</head>
<body>
<p><a href="p1.html">Page 1</a></p>
<p><a href="p2.html">Page 2</a></p>
<p>Page 3</p>
<p><a href="p4.html">Page 4</a></p>
<p> </p>
</body>
</html>
第4页像这个
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="sessvars.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>p4</title>
</head>
<body>
<p><a href="p1.html">Page 1</a></p>
<p><a href="p2.html">Page 2</a></p>
<p><a href="p3.html">Page 3</a></p>
<p>Page 4</p>
</body>
</html>
您将希望使用在javascript中创建的cookie来存储它们在逐步过程中的状态。
结账http://www.w3schools.com/js/js_cookies.asp
制作一个cookie,存储用户达到的最高步骤。在每个页面上检查该值,如果他们所在的页面"更高"(步骤4>步骤3),则用该新值覆盖cookie。这样,如果他们从第4步返回到第1步,他们仍然可以"访问"第4步。