任何人都可以帮我解决以下问题吗?
我有一个导航栏,例如:
Step_1.html - Step_2.html - Step_3.html - Step_4.html
我想要接下来的两个步骤的链接,即3和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>
像这样
<!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>
答案 0 :(得分:0)
您将要使用在javascript中创建的Cookie来存储它们在逐步过程中的状态。
查看http://www.w3schools.com/js/js_cookies.asp
制作一个存储用户最高步骤的cookie。检查每个页面上的值,如果它们所在的页面是“更高”(步骤4&gt;步骤3),则用这个新值覆盖cookie。这样,如果他们从第4步回到第1步,他们仍然可以“访问”第4步。