<!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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script class="jquery library" src="http://runjs.cn/js/sandbox/jquery/jquery-1.8.2.min.js" type="text/javascript"></script>
<title>RunJS 演示代码</title>
<script id="jquery_183" type="text/javascript" class="library" src="http://runjs.cn/js/sandbox/jquery/jquery-1.8.3.min.js"></script>
<script language="JavaScript" type="text/javascript" src="http://www.my97.net/dp/My97DatePicker/WdatePicker.js"></script>
<style type="test/css">
</style>
</head>
<body>
<a href="/zx.html">aaaaaaaa</a>
<a href="/zx.html">bbbbbbbbbbb</a>
<a href="/zx1.html">aaaccccccccccccaaaaa</a>
</body>
<script>
var myDate = new Date();
var hour = myDate.getTime();
alert(parseInt(hour/1000));
if(hour>23|| hour<=9){
$("a[href='/zx.html']").attr("href",'/ccc.html');
$("a[href='/zx.html']").hide();
}
</script>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script class="jquery library" src="http://runjs.cn/js/sandbox/jquery/jquery-1.8.2.min.js" type="text/javascript"></script>
<title>RunJS 演示代码</title>
<script id="jquery_183" type="text/javascript" class="library" src="http://runjs.cn/js/sandbox/jquery/jquery-1.8.3.min.js"></script>
<script language="JavaScript" type="text/javascript" src="http://www.my97.net/dp/My97DatePicker/WdatePicker.js"></script>
<style type="test/css">
</style>
</head>
<body>
<a href="/zx.html">aaaaaaaa</a>
<a href="/zx.html">bbbbbbbbbbb</a>
<a href="/zx1.html">aaaccccccccccccaaaaa</a>
</body>
<script>
var myDate = new Date();
var hour = myDate.getTime();
alert(parseInt(hour/1000));
if(hour>23|| hour<=9){
$("a[href='/zx.html']").attr("href",'/ccc.html');
$("a[href='/zx.html']").hide();
}
</script>
</html>
本文介绍了一种利用JavaScript实现对网页中特定链接进行条件性隐藏和重定向的方法。通过判断当前时间并根据时间条件来控制指定链接的行为,包括更改链接地址和隐藏链接。此外,还展示了如何引入外部JavaScript库来辅助实现这一目标。

1018

被折叠的 条评论
为什么被折叠?



