js换肤并存入cookie,奇怪的问题

odejia 2010-03-05 04:49:07
在本机上直接运行index.htm文件,可正确使用“个性设置”,并一切正常。
但放在服务器上,使http://localhost或ip地址打开首页index.htm就不行了。
望高手看看,感激不尽!

index.htm(部分)源代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>网址导航</title><link rel="search" type="application/opensearchdescription+xml" title="1616集成搜索" href="http://i.9533.com/1616.xml"><meta content="网址大全" name=keywords><meta content="个性化首页。为您提供绿色,安全的内容,以及最好的上网导航服务。" name=description><base target=_blank><link href=http://i.9533.com/img/mx.css?v=1259457256 rel="stylesheet" type="text/css"><link id=sl href=http://i.9533.com/img/s2.css rel="stylesheet" type="text/css"><link id=ft href=http://i.9533.com/img/f1.css rel="stylesheet" type="text/css"><script>document.domain = location.hostname.split(".").slice(-2).join(".");</script></head><body onmousedown="stat(event)"><div id=wrap><div id=wrap-top><div id=top><ul id=topin><li class=maillogin><iframe src=m2.htm scrolling=no allowTransparency=true id=ifmail frameborder=0></iframe></li><li class=t-my1616><a class=my1616-bt id=my1616 onclick='my1616()'>个性设置</a><div id=t-my1616-set><iframe src=about:blank scrolling=no allowTransparency=true frameborder=0></iframe></div></li><li class=t-kp><a href=http://www.1616.net/k.htm target=_self>宽屏版</a></li><li class=t-reh><a href=http://www.1616.net/misc/home.htm>首页修复</a></li><li class=t-seth><a onclick='set_home(this)' href='javascript:;'>设为主页</a></li></ul></div><div id=banner><a id=logo onclick='set_home(this)' title='设为主页' class=logo></a><div id=clock><ul class=clockdate><li id=dat_output style="position:relative;"></li></ul><div class=clocktime><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id=clockswf codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="118" height="55"><param name="movie" value="./img/clock.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent"><embed src="./img/clock.swf" name="clockswf" id=clockswf quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="118" height="55" wmode="transparent"></embed></object></div></div><iframe id=if-w src=weather.htm scrolling=no allowTransparency=true frameborder=0></iframe><script src=http://i.9533.com/js/mx_1.js></script></div><div id=s-wrap><div id=tishi></div><div id=s><div id=t><div class=t-l><a target=_self href="javascript:set_so(0)" class="t-l-tab cur" id=so0>网页</a><a class=t-l-tab target=_self href="javascript:set_so(1)" id=so1>MP3</a><a class=t-l-tab target=_self href="javascript:set_so(2)" id=so2>影视</a><a class=t-l-tab target=_self href="javascript:set_so(3)" id=so3>视频</a><a class=t-l-tab target=_self href="javascript:set_so(4)" id=so4>图片</a><a class=t-l-tab target=_self href="javascript:set_so(5)" id=so5>贴吧</a><a class=t-l-tab target=_self href="javascript:set_so(6)" id=so6>更多</a></div><div class=t-post><a href=http://bbs.1616.net/thread-10375-1-1.html class=hot2>在线听歌新增加歌曲分享功能!</a></div></div><div id=s_all><ul id=search><li class=search-l><a id=sp-img href=http://www.google.cn/webhp?client=aff-maxthon&channel=channel2><img src=http://i.9533.com/img/sp0.gif></a></li><li class="opts search-c"><div id=kwh></div><input id=keyword onmouseover="this.focus()" onkeypress="search(event)" onkeyup="hint(event)"><input type=button id=s-btn onclick="do_s()" value="搜 索"><ul id=sps onclick='set_sp()'><li><input type=radio name=sp id=sp0><label for=sp0>百度</label></li><li><input type=radio checked name=sp id=sp1><label for=sp1>Google</label></li><li><input type=radio name=sp id=sp2><label for=sp2>搜狗</label></li><li><input type=radio name=sp id=sp3><label for=sp3>集成搜索</label></li></ul></li><li id=kws class=search-r></li></ul><div id=s-c><iframe marginwidth=0 marginheight=0 allowTransparency=true frameborder=0 scrolling=no src=about:blank></iframe></div></div></div></div><div id=best><div id=chaxun class=t-box><div class=t style="padding-left:20px"><a href=http://chaxun.1616.net>实用查询 »</a></div><ul id=chaxunlist><li><a href=http://chaxun.1616.net/shouji.htm>手机归属</a></li><li><a href=http://chaxun.1616.net/lieche.htm>列车时刻</a></li><li><a href=http://chaxun.1616.net/wangsu.htm>网速测试</a></li><li><a href=http://chaxun.1616.net/ip.htm>I P 地址</a></li><li><a href=http://wannianli.1616.net>万 年 历</a>
</body>
</html>
...全文
144 点赞 收藏 6
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
odemail 2010-03-10
ddddddddddddddddddddd
回复
odejia 2010-03-06
高手呢???到那里去了。
回复
odejia 2010-03-06
顶起来。ddddddddddddddd
回复
odejia 2010-03-05
以上这个是 my1616.htm完整源码
回复
shan1119 2010-03-05
escape(top.location.href)
unescape(top.location.href)
回复
odejia 2010-03-05
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link id=sl href=http://i.9533.com/img/s2.css rel="stylesheet" type="text/css"><script>document.domain = location.hostname.split(".").slice(-2).join(".");</script></head><style>* {margin:0;padding:0}body {font-size:12px}ul, li {list-style-type:none}img {border:0}label, a {cursor:pointer}.t-my1616-set-in{width:308px;height:262px;overflow:hidden;padding:0 0 10px 0;background:#fff}.my1616-tabt{height:23px}.my1616-tabt li {float:left;height:18px;margin-left:5px;width:80px;text-align:center;padding:4px 0 0 0;border:1px solid #D8D8D8;border-bottom:none;background:#FDFDE8;} .my1616-tabt li a{text-decoration:none}.my1616-tabt li.my1616-tab-on {height:19px;position:relative;margin-bottom:-1px;border:1px solid #ccc;border-bottom:none;background:#fff;font-weight:bold}.my1616-tabb{border-top:1px solid #ccc;padding:8px;overflow:hidden;_overflow:visible;_height:0;clear:both}.my1616-tabb a.my1616-sbg,.my1616-tabb a.my1616-sbg-on{text-decoration:none;padding:1px;width:138px;margin:5px 4px 0 0;_margin:5px 5px 0 0;float:left}.my1616-tabb a.my1616-sbg{border:1px solid #ccc}h6{text-align:center;font:12px normal;color:#666;line-height:20px}.my1616-tabb td{padding:4px 0}.my1616-tabb td.t-my1616-set-tl{width:68px;font-weight:bold; vertical-align:top;padding-top:10px}.my1616-type label{margin:4px 8px 4px 0;*margin:0 0 4px 0;width:28px;display:inline-block}.my1616-type span{display:inline-block;width:12px;height:12px;overflow:hidden;border:1px solid #999;margin-left:4px}.my1616-bgset{width:202px;height:96px}.my1616-bgset a{display:inline-block;border:1px solid #ccc;margin:4px 0 0 4px}.my1616-bgset a:hover,.my1616-tabb a.my1616-sbg:hover{border:1px solid #999}.setarea{padding:0 10px}.setarea input{line-height:160%;vertical-align:middle}.quxiao{color:#06c; vertical-align:middle}.my1616-btwarp *{ vertical-align:middle}.c1{background:#BDE1F9}.c2{background:#BCFED0}.c3{background:#FCC}.f1{background:#000}.f2{background:#036}.f3{background:#930}.f4{background:#606}.f5{background:#666}.f6{background:#39c}.f7{background:#c93}.f8{background:#f69}#setting2 {display:none}#setting2 img {width:138px;height:70px}</style><body><div class=t-my1616-set-in> <div class=my1616-tab> <ul class=my1616-tabt><li class=my1616-tab-on id=tab1><a onclick='show_setting(1)'>自定义主题</a></li><li id=tab2><a onclick='show_setting(2)'>系统主题</a></li></ul> <div class=my1616-tabb id=setting1 style="height:198px"><table width="100%" border=0 cellspacing=0 cellpadding=0><tr><td class=t-my1616-set-tl>页面风格:</td><td class=my1616-type><input type=radio name=color id=color1 /><label for=color1><span class=c1></span></label><input type=radio name=color id=color2 checked /><label for=color2><span class=c2></span></label><input type=radio name=color id=color3 /><label for=color3><span class=c3></span></label></td></tr><tr> <td class=t-my1616-set-tl>字体颜色:</td> <td class=my1616-type> <input type=radio name=font id=font1 checked /><label for=font1><span class=f1></span></label> <input type=radio name=font id=font2 /><label for=font2><span class=f2></span></label> <input type=radio name=font id=font3 /><label for=font3><span class=f3></span></label> <input type=radio name=font id=font4 /><label for=font4><span class=f4></span></label><br> <input type=radio name=font id=font5 /><label for=font5><span class=f5></span></label> <input type=radio name=font id=font6 /><label for=font6><span class=f6></span></label> <input type=radio name=font id=font7 /><label for=font7><span class=f7></span></label> <input type=radio name=font id=font8 /><label for=font8><span class=f8></span></label> </td></tr><tr> <td class=t-my1616-set-tl>页面背景:</td> <td> <div class=my1616-bgset id=bgset> <a class=my1616-bgset-on onclick="set_bg(1)" id=bg1><img src="http://i.9533.com/img/myb1.gif" /></a><a onclick="set_bg(2)" id=bg2><img src="http://i.9533.com/img/myb2.gif" /></a><a onclick="set_bg(3)" id=bg3><img src="http://i.9533.com/img/myb3.gif" /></a><a onclick="set_bg(4)" id=bg4><img src="http://i.9533.com/img/myb4.gif" /></a><a onclick="set_bg(5)" id=bg5><img src="http://i.9533.com/img/myb5.gif" /></a><a onclick="set_bg(6)" id=bg6><img src="http://i.9533.com/img/myb6.gif" /></a> </div> </td></tr></table> </div><div class="my1616-tabb" id=setting2><a class=my1616-sbg-on onclick='set_theme("guoqing")' id=th1><img src=http://i.9533.com/img/z002.png /><h6>国庆60周年</h6></a><a class=my1616-sbg onclick='set_theme("zhongqiu")' id=th2><img src=http://i.9533.com/img/z003.png /><h6>中秋月圆</h6></a><a class=my1616-sbg onclick='set_theme("xiyangyang")' id=th3><img src=http://i.9533.com/img/z004.png /><h6>喜羊羊与灰太郎</h6></a><a class=my1616-sbg onclick='set_theme("fendou2009")' id=th4><img src=http://i.9533.com/img/z005.png /><h6>奋斗2010</h6></a> </div> </div> <div class=setarea><input style="width:70px" type=button onclick="apply()" value="保存设置" /><input type=button style="width:110px;margin-left:10px" onclick="restore()" value="恢复默认设置" />  <a class="quxiao" href='javascript:rollback()'>取消本次操作</a></div></div><script>var is800 = false;var vurl = "index-800.htm";var reg = new RegExp(vurl,"i");if(is800 = !!top.location.href.match(reg)){$("tab2").style.visibility = "hidden";}var settings = [1,0,1], dm, old_settings = [1,0,1], cur_tab = 1; function $(i) {return document.getElementById(i)}function $n(n) {return document.getElementsByName(n)}function euc(s) {return encodeURIComponent(s)}function setCookie(n, v, e, d) { var t = new Date(); if (!e) e = 365; e = e * 1000 * 60 * 60 * 24; var e_date = new Date(t.getTime() + e); document.cookie = n + '=' + euc(v) + ';expires=' + e_date.toGMTString() + ';path=/' + ((d) ? ';domain=' + d : '');}function getCookie(n){ var c = document.cookie.split("; "); for(var i=0; i<c.length; i++) { var p = c[i].split("="); if(n == p[0]) try{return decodeURIComponent(p[1])}catch(e){return null} } return null;}function set_bg(bg, dont_apply){for(var i=1; i<7; i++)$('bg' + i).className = '';$('bg' + bg).className = 'my1616-bgset-on';if(!dont_apply){settings[2] = bg;apply_immed();}}function set_theme(th, dont_apply){var themes = ['', 'guoqing', 'zhongqiu', 'xiyangyang', 'fendou2009'];for(var i=1; i<5; i++) $('th' + i).className = th==themes[i] ? 'my1616-sbg-on' : 'my1616-sbg';$('sl').href = 'http://i.9533.com/img/theme/' + th + '/s_l_n.css';if(!dont_apply){settings = [th];apply_immed();}}function apply_immed(){if(cur_tab == 1){var es = $n('color');for(var i=0; i<es.length; i++) if(es[i].checked) settings[0] = i;es = $n('font');for(var i=0; i<es.length; i++) if(es[i].checked) settings[1] = i;var as = $('bgset').getElementsByTagName("a");for(var i=0; i<as.length; i++)if(as[i].className == 'my1616-bgset-on')settings[2] = i+1;}setCookie('mx_style', settings.join('|'), 0, dm);setCookie('old_s', old_settings.join('|'), 1);top.set_style();}function apply(){apply_immed();top.close_style();}function set_style(s){settings = [].concat(s);if(s.length == 3){var cls = $n('color'), fs = $n('font');cls[settings[0]].checked = true;fs[settings[1]].checked = true;set_bg(settings[2], 1);}else set_theme(settings[0], 1);setCookie('mx_style', settings.join('|'), 0, dm);setCookie('old_s', old_settings.join('|'), 1);top.set_style();top.close_style();}function restore(){set_style([1,0,1]);}function rollback(){set_style(old_settings);}function show_setting(t){for(var i=1; i<3; i++){$('tab' + i).className = i==t ? 'my1616-tab-on' : '';$('setting' + i).style.display = i==t ? 'block' : 'none';}cur_tab = t;}(function() {dm = location.host.split(".").slice(-2).join(".");var inps = document.getElementsByTagName('INPUT');for(var i=0; i<inps.length; i++)if(inps[i].type == 'radio')inps[i].onclick = apply_immed;var ss = getCookie('mx_style');if(ss){var ssf = ss.split('|');if(is800){ssf = ssf.length == 1 ? settings : ssf;} if(ssf.length == 1){settings = ssf;set_theme(ssf[0], 1);show_setting(2);}else if(ssf.length == 3)try{var cls = $n('color'), fs = $n('font');var pss = [parseInt(ssf[0]), parseInt(ssf[1]), parseInt(ssf[2])];if(cls.length > pss[0] && fs.length > pss[1] && 7 > pss[2]){cls[pss[0]].checked = true;fs[pss[1]].checked = true;set_bg(pss[2], 1);settings = pss;}$('sl').href = 'http://i.9533.com/img/s' + (pss[0]+1) + '.css'}catch(e){}}var old_s = getCookie('old_s');if(old_s) old_settings = old_s.split('|');else old_settings = [].concat(settings);})();</script></body></html>
回复
相关推荐
发帖
JavaScript
创建于2007-09-28

8.5w+

社区成员

Web 开发 JavaScript
申请成为版主
帖子事件
创建了帖子
2010-03-05 04:49
社区公告
暂无公告