内置网页优化代码
前言
根据之前的内置网页代码进行了优化,虽然不是很好看,功能上还是可以说的过去的,大家不要介意
示例图
代码
<?php
$url='http://cloud.iccci.cc';
$v1='http://cloud.iccci.cc';//友情链接1
$v1name='CC云';//友情链接1名称
$v2='https://www.lanmicloud.com/?aff=ab811';//友情链接2
$v2name='蓝米云';//友情链接2名称
$content=file_get_contents("$url");
$pos = strpos($content,'utf-8');
if($pos===false){$content = iconv("gbk","utf-8",$content);}
$postb=strpos($content,'<title>')+7;
$poste=strpos($content,'</title>');
$length=$poste-$postb;
?>
<!doctype html>
<html class="container">
<head>
<meta charset="utf-8">
<script type="text/javascript">
//判断时间是否为个位数,如果时间为个位数就在时间之前补上一个“0”
function check(val) {
if (val < 10) {
return ("0" + val);
}
else {
return (val);
}
}
function displayTime() {
//获取div元素
var timeDiv=document.getElementById("timeDiv");
//获取系统当前的年、月、日、小时、分钟、毫秒
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var hour = date.getHours();
var minutes = date.getMinutes();
var second = date.getSeconds();
var timestr = year + "年" + month + "月" + day + "日 " + check(hour)
+ ":" + check(minutes) + ":" + check(second);
//将系统时间设置到div元素中
timeDiv.innerHTML = timestr;
}
//每隔1秒调用一次displayTime函数
function start(){
window.setInterval("displayTime()",1000)//单位是毫秒
}
</script>
</head>
<style>
.container {
width: 100%;
height: 100%;
margin: 0% auto 0;
background-color: #f0f0f0;
padding: 0% 0% 0% 0%;
border-radius: 20px
}
ul {
padding-left: 20px;
}
ul li {
line-height: 2.3
}
a {
color: #FFFFFF;
text-decoration:none
}
.button {
background: #eb94d0;
/* 创建渐变 */
background-image: -webkit-linear-gradient(top, #eb94d0, #2079b0);
background-image: -moz-linear-gradient(top, #eb94d0, #2079b0);
background-image: -ms-linear-gradient(top, #eb94d0, #2079b0);
background-image: -o-linear-gradient(top, #eb94d0, #2079b0);
background-image: linear-gradient(to bottom, #eb94d0, #2079b0);
/* 给按钮添加圆角 */
-webkit-border-radius: 28;
-moz-border-radius: 28;
border-radius: 28px;
text-shadow: 3px 2px 1px #9daef5;
-webkit-box-shadow: 6px 5px 24px #666666;
-moz-box-shadow: 6px 5px 24px #666666;
box-shadow: 6px 5px 24px #666666;
font-family: Arial;
color: #fafafa;
font-size: 20px;
padding: 5px;
text-decoration: none;
}
/* 悬停样式 */
.button:hover {
background: #2079b0;
background-image: -webkit-linear-gradient(top, #2079b0, #eb94d0);
background-image: -moz-linear-gradient(top, #2079b0, #eb94d0);
background-image: -ms-linear-gradient(top, #2079b0, #eb94d0);
background-image: -o-linear-gradient(top, #2079b0, #eb94d0);
background-image: linear-gradient(to bottom, #2079b0, #eb94d0);
text-decoration: none;
}
.ico {
width: 25%;
height: 25%;
vertical-align: middle;
margin:0px 0px 15px 0px;
}
</style>
<body onload="start();" class="container">
<div class="container">
<div style="padding: 5px; background-color: #101f30; border-radius: 5px; text-align: center;">
<h2 class="margin-0 text-muted">
<font color="white" size="10">当前时间:<b id="timeDiv"></b><br>网站标题:<a target="_blank" href="<?php echo($url); ?>"><?php echo substr($content,$postb,$length); ?></a>
</font>
</h2>
</div>
<iframe src="<?php echo($url); ?>" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="yes" allowtransparency="yes">
</iframe>
<div style="padding: 5px; background-color: #101f30; border-radius: 5px; text-align: center;">
<h4 class="margin-0 text-muted">
<font color="white" size="10">友情链接:
<button class="button button:hover" title="<?php echo($v1name); ?>"><a target="_blank" href="<?php echo($v1); ?>"><font size="10"><?php echo($v1name); ?></a></button> 
<button class="button button:hover" title="<?php echo($v2name); ?>"><a target="_blank" href="<?php echo($v2); ?>"><font size="10"><?php echo($v2name); ?></a></button>
</script>
</font>
</h4>
</div>
</div>
</body>
</html>
本文作者:追萌小黑
本文标题:内置网页优化代码
本文链接:https://blog.dxtao.cn/archives/426.html
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,请不要用于商业用途及非法用途,否则后果自负!
3. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
4. 如有链接无法下载、失效或广告,请联系管理员处理!
5. 如遇到加密压缩包,默认解压密码为"blog.dxtao.cn",如遇到无法解压的请联系管理员!
追萌小黑是一个优秀的分享资源站,本站部分资源为互联网收集及各位网友分享而来,特殊原创会标明如有侵犯版权等可联系17334723@qq.com 删除
本文标题:内置网页优化代码
本文链接:https://blog.dxtao.cn/archives/426.html
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,请不要用于商业用途及非法用途,否则后果自负!
3. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
4. 如有链接无法下载、失效或广告,请联系管理员处理!
5. 如遇到加密压缩包,默认解压密码为"blog.dxtao.cn",如遇到无法解压的请联系管理员!
追萌小黑是一个优秀的分享资源站,本站部分资源为互联网收集及各位网友分享而来,特殊原创会标明如有侵犯版权等可联系17334723@qq.com 删除
THE END
二维码
文章目录
关闭