繁体   English   中英

JavaScript帮助-带有Page事件/变量

[英]JavaScript Help - With Page event/Var

谁能在以下方面帮助我?

我有一个导航栏,例如:

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>

像这样的第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>&nbsp;</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。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM