用html和JavaScript写页面有刷新一次页面,页面上显示加一的功能怎么实现? 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script type="text/javascript"> String.prototype.Trim = function() { return this.replace(/^\s+/g,"").replace(/\s+$/g,""); } function JSCookie() { this.GetCookie = function(key) { var cookie = document.cookie; var cookieArray = cookie.split(';'); var getvalue = ""; for(var i = 0;i<cookieArray.length;i++) { if(cookieArray[i].Trim().substr(0,key.length) == key) { getvalue = cookieArray[i].Trim().substr(key.length + 1); break; } } return getvalue; }; this.GetChild = function(cookiekey,childkey) { var child = this.GetCookie(cookiekey); var childs = child.split('&'); var getvalue = ""; for(var i = 0;i < childs.length;i++) { if(childs[i].Trim().substr(0,childkey.length) == childkey) { getvalue = childs[i].Trim().substr(childkey.length + 1); break; } } return getvalue; }; this.SetCookie = function(key,value,expire,domain,path) { var cookie = ""; if(key != null && value != null) cookie += key + "=" + value + ";"; if(expire != null) cookie += "expires=" + expire.toGMTString() + ";"; if(domain != null) cookie += "domain=" + domain + ";"; if(path != null) cookie += "path=" + path + ";"; document.cookie = cookie; }; this.Expire = function(key) { expire_time = new Date(); expire_time.setFullYear(expire_time.getFullYear() - 1); var cookie = " " + key + "=e;expires=" + expire_time + ";" document.cookie = cookie; }}window.onload = function(){ var cookie = new JSCookie(); var n = cookie.GetCookie("n"); if(n=="") n=0; document.getElementById("pad").innerHTML = n; n++; var expire_time = new Date(); expire_time.setFullYear(expire_time.getFullYear() + 1); cookie.SetCookie("n", n, expire_time);}</script><div id="pad"></div> css背景图片 先加载完成 后渲染 问题,希望大家看看 我已经找到一个JQUERY对象,怎么用after方法将其插入到另一个元素的最后面 onload 事件,如何用setTimeout延时执行? ie下求div的绝对边距有误,求解 如何防止本站.js文件被其他站直接引用 急:不能创建ActiveXObject 对象 关于日历翻月的问题~~希望能解决 急:dettachEvent为什么失败? 字符串转换成数值类型的函数是什么 javascript问题 用js怎么在table里实现键盘向上向下 javascript小问题
<script type="text/javascript">
String.prototype.Trim = function()
{
return this.replace(/^\s+/g,"").replace(/\s+$/g,"");
}
function JSCookie()
{
this.GetCookie = function(key)
{
var cookie = document.cookie;
var cookieArray = cookie.split(';');
var getvalue = "";
for(var i = 0;i<cookieArray.length;i++)
{
if(cookieArray[i].Trim().substr(0,key.length) == key)
{
getvalue = cookieArray[i].Trim().substr(key.length + 1);
break;
}
} return getvalue;
};
this.GetChild = function(cookiekey,childkey)
{
var child = this.GetCookie(cookiekey);
var childs = child.split('&');
var getvalue = "";
for(var i = 0;i < childs.length;i++)
{
if(childs[i].Trim().substr(0,childkey.length) == childkey)
{
getvalue = childs[i].Trim().substr(childkey.length + 1);
break;
}
}
return getvalue;
};
this.SetCookie = function(key,value,expire,domain,path)
{
var cookie = "";
if(key != null && value != null)
cookie += key + "=" + value + ";";
if(expire != null)
cookie += "expires=" + expire.toGMTString() + ";";
if(domain != null)
cookie += "domain=" + domain + ";";
if(path != null)
cookie += "path=" + path + ";";
document.cookie = cookie;
};
this.Expire = function(key)
{
expire_time = new Date();
expire_time.setFullYear(expire_time.getFullYear() - 1);
var cookie = " " + key + "=e;expires=" + expire_time + ";"
document.cookie = cookie;
}
}window.onload = function(){
var cookie = new JSCookie();
var n = cookie.GetCookie("n");
if(n=="") n=0;
document.getElementById("pad").innerHTML = n;
n++;
var expire_time = new Date();
expire_time.setFullYear(expire_time.getFullYear() + 1);
cookie.SetCookie("n", n, expire_time);
}
</script>
<div id="pad"></div>