亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

給blog加上運(yùn)行代碼功能

 更新時(shí)間:2006年09月18日 00:00:00   作者:  
在和尚那里看到他給z-blog加上了運(yùn)行代碼功能,放了幾天假,有些怕怕再這樣閑下去會(huì)生銹的,在補(bǔ)了一個(gè)半小時(shí)的覺(jué)之后,也給blog加上運(yùn)行功能,因?yàn)槭菑腖-Blog修改而來(lái),因此同樣適用于L-Blog,另外,F(xiàn)BS也是L-Blog修改而來(lái),應(yīng)該也可以使用本文中的方法來(lái)添加運(yùn)行代碼功能。另外,由于復(fù)制代碼和保存代碼還沒(méi)有找到兼容各瀏覽器的解決方法,就沒(méi)有加進(jìn)來(lái)了。
示例:
步驟如下:
1. 在 include/common.js 中添加如下代碼:
復(fù)制代碼 代碼如下:

function runCode(codeobjid)  {
    var codeobj=document.getElementById(codeobjid)
    var codestr=codeobj.value;
    if (codestr!="") {
        var codewin=window.open('','','');  
        codewin.document.open('text/html','replace');
        codewin.opener = null 
        codewin.document.write(codestr);  
        codewin.document.close();
    }

}
2. 在 include/ubbcode.asp 中找到 strContent=re.Replace(strContent,"【code】")(把【】換成[]),在此之后添加如下代碼:
L-Blog:
復(fù)制代碼 代碼如下:

re.Pattern="\[html\](<br>)+"
strContent=re.Replace(strContent,"【html】")

FBS:
復(fù)制代碼 代碼如下:

re.Pattern="\[html\](<br />)+"
strContent=re.Replace(strContent,"【html】")

再找到 re.Pattern="\[code\](.*?)\[\/code\]",然后在段代碼的 Set strMatches=Nothing 之后添加如下代碼:
復(fù)制代碼 代碼如下:

re.Pattern="\[html\](.*?)\[\/html\]"
Set strMatches=re.Execute(strContent)
For Each strMatch In strMatches
    RNDStr=Int(7999 * Rnd + 2000)
    tmpStr1=strMatch.SubMatches(0)
    strContent= Replace(strContent,strMatch.Value,"<textarea rows=""10"" "_
&"style=""width:90%;"" class=""input_border"" id=""HTML_"&RNDStr&""">"_
&tmpStr1&"</textarea><br />"_
&"<input type=""button"" onclick=""runCode('HTML_"&RNDStr&"');"" value=""運(yùn)行代碼"" />"_
&" [Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運(yùn)行]")
Next

Set strMatches=Nothing
3. 修改完成,在發(fā)表日志時(shí)就可以使用【html】要運(yùn)行的代碼【/html】(將【】替換成[])來(lái)使用運(yùn)行代碼功能。

相關(guān)文章

最新評(píng)論