|
主题:发布文章代码乱码bug!!请管理员看看 [收藏主题] | 转到: |
发布网页代码内容,在后台发布时没问题,但在前台发布时,保存到数据库和前台浏览时都是乱码. 比如,发布以下内容时: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 保存到数据库或在前台浏览的结果是: lt!DOCTYPE html PUBLIC -W3CDTD XHTML 1.0 TransitionalEN A href=httpwww.w3.orgTRxhtml1DTDxhtml1-transitional.dtdhttpwww.w3.orgTRxhtml1DTDxhtml1-transitional.dtdAgtBRlthtml xmlns=A href=httpwww.w3.org1999xhtmlhttpwww.w3.org1999xhtmlAgtBRltheadgtBRltmeta http-equiv=Content-Type content=texthtml charset=gb2312 gtBRlttitlegtCSS+JS打造类似QQ的网站导航菜单特效lttitlegtBRltstyle type=textcssgtBRbody font12px Tahoma, sans-serifcolor4D4D4Dmargin0px text-aligncenterBRacolor4D4D4Dtext-decorationnoneBRahovercolorAD0000text-decorationnoneBRmenu width160pxmargin0pxpadding0pxtext-alignleftlist-stylenoneborder1px solid B0D4EDBRmenu .item margin0pxpadding0pxlist-stylenone text-aligncenterBRa.titlelink,a.titlevisited,a.titlehover displayblockheight30pxline-height30px margin-top1pxbackgroundE1F2FDborder-top1px solidnbsp B0D4EDborder-bottom1px solid B0D4EDfont-weightboldBRmenu .item ul margin0list-stylenonedisplaynonetext-aligncenterBRmenu .item ul li height24pxline-height22pxborder-bottom1px solid BFDBEEmargin0 20pxBRltstylegtBRltscript language=javascript type=textjavascriptgtBR --- 获取ClassNameBRdocument.getElementsByClassName = functioncl BRnbspvar retnode = BRnbspvar myclass = new RegExpb+cl+bBRnbspvar elem = this.getElementsByTagName*BRnbspfor var j = 0 j lt elem.length j++ BRnbsp var classes = elemj.classNameBRnbsp if myclass.testclasses retnode.pushelemjBRnbspBRnbspreturn retnodeBRBR --- 隐藏所有BRfunction HideAll BRnbspvar items = document.getElementsByClassNameoptitonBRnbspfor var j=0 jltitems.length j++ BRnbsp itemsj.style.display = noneBRnbspBRBR --- 设置cookieBRfunction setCookiesName,sValue,expireHours BRnbspvar cookieString = sName + = + escapesValueBRnbsp判断是否设置过期时间BRnbspif expireHoursgt0 BRnbspnbsp var date = new DateBRnbspnbsp date.setTimedate.getTime + expireHours * 3600 * 1000BRnbspnbsp cookieString = cookieString + expire= + date.toGMTStringBRnbspBRnbspdocument.cookie = cookieStringBRBR--- 获取cookieBRfunction getCookiesName BRnbsp var aCookie = document.cookie.split BRnbsp for var j=0 j lt aCookie.length j++BRnbspvar aCrumb = aCookiej.split=BRnbspif escapesName == aCrumb0BRnbspnbsp return unescapeaCrumb1BRnbsp BRnbsp return nullBRBRwindow.onload = function BRnbspvar show_item = opt_1BRnbspif getCookieshow_item != null BRnbspnbsp show_item= opt_ + getCookieshow_itemBRnbspBRnbspdocument.getElementByIdshow_item.style.display = blockBRnbspvar items = document.getElementsByClassNametitleBRnbspfor var j=0 jltitems.length j++ BRnbsp itemsj.onclick = function BRnbspnbsp var o = document.getElementByIdopt_ + this.nameBRnbspnbsp if o.style.display != block BRnbspnbspnbsp HideAllBRnbspnbspnbsp o.style.display = blockBRnbspnbspnbsp setCookieshow_item,this.nameBRnbspnbsp BRnbspnbsp else BRnbspnbspnbsp o.style.display = noneBRnbspnbsp BRnbsp BRnbspBRBRltscriptgtBRltheadgtBRltbodygtBRltul id=menugtBRnbspltli class=itemgtlta href=javascriptvoid0 class=title name=1gt菜单选项一ltagtBRnbspnbsp ltul id=opt_1 class=optitongtBRnbspnbspnbsp ltligtlta href=gt子菜单一ltagtltligtBRnbspnbspnbsp ltligtlta href=gt子菜单二ltagtltligtBRnbspnbspnbsp ltligtlta href=gt子菜单三ltagtltligtBRnbspnbspnbsp ltligtlta href=gt子菜单四ltagtltligtBRnbspnbsp ltulgtBRnbspltligtBRnbspltli class=itemgtlta href=javascriptvoid0 class=title name=2gt菜单选项二ltagtBRnbspnbsp ltul id=opt_2 class=optitongtBRnbspnbspnbsp ltligtlta href=gt子菜单一ltagtltligtBRnbspnbspnbsp ltligtlta href=gt子菜单二ltagtltligtBRnbspnbspnbsp ltligtlta href=gt子菜单三ltagtltligtBRnbspnbspnbsp ltligtlta href=gt子菜单四ltagtltligtBRnbspnbsp ltulgtBRnbspltligtBRnbspltli class=itemgtlta href=javascriptvoid0 class=title name=3gt菜单选项三ltagtBRnbspnbsp ltul id=opt_3 class=optitongtBRnbspnbspnbsp ltligtlta href=gt子菜单一ltagtltligtBRnbspnbspnbsp ltligtlta href=gt子菜单二ltagtltligtBRnbspnbspnbsp ltligtlta href=gt子菜单三ltagtltligtBRnbspnbspnbsp ltligtlta href=gt子菜单四ltagtltligtBRnbspnbsp ltulgtBRnbspltligtBRnbspltli class=itemgtlta href=javascriptvoid0 class=title name=4gt菜单选项四ltagtBRnbspnbsp ltul id=opt_4 class=optitongtBRnbspnbspnbsp ltligtlta href=gt子菜单一ltagtltligtBRnbspnbspnbsp ltligtlta href=gt子菜单二ltagtltligtBRnbspnbspnbsp ltligtlta href=gt子菜单三ltagtltligtBRnbspnbspnbsp ltligtlta href=gt子菜单四ltagtltligtBRnbspnbsp ltulgtBRnbspltligtBRltulgt BRltbodygtBRlthtmlgt 请各位测试 [此贴子已经被作者于2007-8-23 17:43:34编辑过] |
|
支持(0) | 反对(0) 顶端 底部 |
支持(0) | 反对(0) 顶端 底部 |
支持(0) | 反对(0) 顶端 底部 |
支持(0) | 反对(0) 顶端 底部 |
<上一主题 | 下一主题 > |