访问中华万年历的文章后台数据


手机里面的中华万年历会推荐一些 小文章,挺好看的,不知道有人知道不,这个可以访问它自己的后台数据,里面有好多好看的小文章,而且每篇小文章都配有一张精美的图片,但是因为图片的原因在手机端访问会消耗很多流量,我于是自己写了个网页程序,这样不仅可以在电脑上浏览,而且可以记录你的浏览历史,方便自己浏览,下面是界面样式


<!-- 
essay.html 访问某个网站只有在手机端可以看到的页面

@author:WangJun

 -->

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WangJun</title>
<base href="http://marketing.etouch.cn/story/">
<style type="text/css">
body {
	margin: 0;
	background: black;
}

a {
	color: red;
}

a:hover {
	background: yellow;
	CURSOR: pointer;
}
</style>
</head>
<body>
	<div
		style="background: black; width: 600px; color: red; margin: 0 auto; padding: 0;">
		<iframe name="content" width="600px" src="" id="content"
			height="600px" style="margin: 0; padding: 0;"></iframe>
		<div style="position: relative; left: 235px; width: 130px;">
			<a οnclick="up()">上一篇</a>    <a οnclick="next()">下一篇</a>
		</div>
		<div>
			<a οnclick="add_bookmark()">加入书签</a> <a οnclick="get_last_bookmark()"
				title="回到你上次阅读的位置">回到上次阅读</a> <a οnclick="add_kill_bookmark()"
				title="觉得文章不好,你可以拍砖,如果大家拍砖次数超过50次,服务器将自动删除被拍砖的文章">拍砖</a> <a
				οnclick="alert('功能未实现...')" title="正在维护中...">目录</a> <a
				οnclick="achive()" title="请在关闭前,点击它,以便你下次继续阅读">阅读进度存档</a> <a
				οnclick="clearCookie()" title="点击后,你的所有进度记录,会被清除">清除所有阅读记录</a>
		</div>
		<div id="test_content"
			style="position: relative; left: 150px; top: -400px; background: black; color: red; width: 300px; overflow: auto; padding: 0;margin: 0;"></div>
	</div>
	<script type="text/javascript">
		//更新文章
		function refrech() {
			var time1 = new Date(1364530409191);//开发日期
			var time2 = new Date();
			var time = time2 - time1;
			var id_time = Math.floor(time / 86400000);
			return 236 - 126 + (id_time * 2);
		}
		var id = refrech();
		var temp_id = id;
		var content = document.getElementById("content");
		var test = document.getElementById("test_content");
		test.style.display = "none";
		var isRead = "";
		var kill = "";
		var last = "";
		var bookmark = "";
		function init() {
			//alert(getCookie('isRead'));
			if (getCookie('isRead') == "") {
				isRead = "你已经阅读过的文章编号:<br>";
			} else {
				isRead = getCookie('isRead');
			}
			if (getCookie('kill') == "")
				kill = "你已经拍砖过的文章编号:<br>";
			else
				kill = getCookie('kill');

			if (getCookie('bookmark') == "")
				bookmark = "你的书签编号:<br>";
			else
				bookmark = getCookie('bookmark');
			//test.style.display=none;
			//alert(isRead+kill)
		}
		init();
		function achive() {
			setCookie("isRead", isRead, 5);
			setCookie("kill", kill, 5);
			setCookie('last', id, 5);
			setCookie('bookmark', bookmark, 5);
			test.innerHTML = isRead + "<br>" + bookmark + "<br>" + kill
					+ "<br/>" + "上次阅读编号:" + getCookie('last');
			test.style.display = "block";
			setTimeout(function() {
				test.style.display = "none";
			}, 6000);
		}
		function setSrc() {
			content.src = "http://marketing.etouch.cn/story/show.jsp?id=" + id;
			isRead = isRead
					+ "<a href='http://marketing.etouch.cn/story/show.jsp?id="
					+ id + "' target='content'>" + id + "</a>" + " | ";
		}
		function next() {
			id = id - 2;
			setSrc();
		}
		function up() {
			id = id + 2;
			if (id > temp_id) {
				test.innerHTML = "每日更新一篇,明天再来看吧!";
				test.style.display = "block";
				id = id - 2;
				setTimeout(function() {
					test.style.display = "none";
				}, 3000);
			} else {
				setSrc();
			}

		}

		/********************加入书签 *********************/
		function getCookie(c_name) {
			if (document.cookie.length > 0) {
				c_start = document.cookie.indexOf(c_name + "=");
				if (c_start != -1) {
					c_start = c_start + c_name.length + 1;
					c_end = document.cookie.indexOf(";", c_start);
					if (c_end == -1)
						c_end = document.cookie.length;
					return unescape(document.cookie.substring(c_start, c_end));
				}
			}
			return "";
		}

		function setCookie(c_name, value, expiredays) {
			var exdate = new Date();
			exdate.setDate(exdate.getDate() + expiredays);
			document.cookie = c_name
					+ "="
					+ escape(value)
					+ ((expiredays == null) ? "" : ";expires="
							+ exdate.toGMTString());
		}

		function add_kill_bookmark() {
			kill = kill
					+ "<a href='http://marketing.etouch.cn/story/show.jsp?id="
					+ id + "' target='content'>" + id + "</a>" + " | ";
			alert("拍砖成功");
		}
		function add_bookmark() {
			bookmark = bookmark
					+ "<a href='http://marketing.etouch.cn/story/show.jsp?id="
					+ id + "' target='content'>" + id + "</a>" + " | ";
			alert("书签加入成功");
		}

		function get_last_bookmark() {
			var id_last_bookmark = getCookie('last');
			if (id_last_bookmark != null && id_last_bookmark != "") {
				id = parseInt(id_last_bookmark);
				setSrc();
			}
		}
		/*********************清除阅读所有记录************************* */
		function clearCookie() {
			var flag = confirm("真的要清除所有记录吗?");
			if (flag) {
				var keys = document.cookie.match(/[^ =;]+(?=\=)/g);
				if (keys) {
					for ( var i = keys.length; i--;)
						document.cookie = keys[i] + '=0;expires='
								+ new Date(0).toUTCString();
				}
				init();
			}

		}
		setSrc();
	</script>
</body>
</html>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值