function getCookie(name)
{
var arr,reg=new RegExp("(^| )"+name+"=([^]*)(|$)")
if(arr=document.cookie.match(reg)) return unescape(arr[2])
else return null
}
var img = getCookie("xxx")
然后 document.getElementById("body").style.backgroundImage = img
<script type="text/javascript">function getCookie(CookieName) {
var Cookie = document.cookie.split(''), tmp
for (var i = 0i <Cookie.lengthi++) {
tmp = Cookie[i].split('=')
if (tmp[0] == CookieName) return tmp[1]
tmp = null
}
Cookie = nullreturn false
}
var aspCookie = getCookie('abc')
if (aspCookie !== false) alert(aspCookie)
</script>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)