编程网站主题根目录下的此文件
vim inc/user/user-profile.php
在下图<div class="clear"></div>
前插入代码,插入位置如下图
插入的代码如下
<script type = "text/javascript" > today = new Date();
var day;
var date;
var hello;
hour = new Date().getHours();
if (hour < 6) {
hello = ' 凌晨好! ';
} else if (hour < 9) {
hello = ' 早上好!';
} else if (hour < 12) {
hello = ' 上午好!';
} else if (hour < 14) {
hello = ' 中午好! ';
} else if (hour < 17) {
hello = ' 下午好! ';
} else if (hour < 19) {
hello = ' 傍晚好!';
} else if (hour < 22) {
hello = ' 晚上好! ';
} else {
hello = '夜深了! ';
}
function GetCookie(sName) {
var arr = document.cookie.match(new RegExp("(^| )" + sName + "=([^;]*)(;|$)"));
if (arr != null) {
return unescape(arr[2])
};
return null;
}
var Guest_Name = decodeURIComponent(GetCookie('author'));
var webUrl = webUrl;
if (Guest_Name != "null") {
hello = Guest_Name + ' , ' + hello + ' 欢迎回来。';
}
document.write(' ' + hello); </script>
<script type="text/javascript ">
var d, s = "";
var x = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
d = new Date();
s += d.getFullYear() + "年" + (d.getMonth() + 1) + "月" + d.getDate() + "日";
s += x[d.getDay()];
document.writeln(s);</script>
公众号
扫码订阅最新深度技术文,回复【资源】获取技术大礼包
评论