給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 中添加如下代碼:
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:
re.Pattern="\[html\](<br>)+"
strContent=re.Replace(strContent,"【html】")
FBS:
re.Pattern="\[html\](<br />)+"
strContent=re.Replace(strContent,"【html】")
再找到 re.Pattern="\[code\](.*?)\[\/code\]",然后在段代碼的 Set strMatches=Nothing 之后添加如下代碼:
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)行代碼功能。
示例:
步驟如下:
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)文章
asp下根據(jù)標(biāo)題生成關(guān)鍵字的代碼
實(shí)現(xiàn)的功能是:標(biāo)題+標(biāo)題里除去非中文及中文標(biāo)點(diǎn)外的字符的、相鄰兩個(gè)字符的集合 傳說(shuō)中這是采集文章處理keywords的最佳方式,呵呵,做了一個(gè),用下試試2008-06-06asp之自動(dòng)閉合HTML/ubb標(biāo)簽函數(shù) 附簡(jiǎn)單注釋
在用到編輯器時(shí),就會(huì)碰到一點(diǎn),那就是標(biāo)簽的閉合問(wèn)題,這個(gè)問(wèn)題非常嚴(yán)峻,因?yàn)檫@可能會(huì)導(dǎo)致網(wǎng)頁(yè)顯示的整體樣式受到破壞。2010-04-04asp中提示至少一個(gè)參數(shù)沒(méi)有被指定值 解決方法
在寫(xiě)SQL語(yǔ)句的時(shí)候,我們經(jīng)常會(huì)調(diào)用一些參數(shù),很可能這些參數(shù)中有一個(gè)沒(méi)有被賦值2012-10-10[圖]Flash+ASP實(shí)現(xiàn)電子互動(dòng)地圖在線(xiàn)標(biāo)注功能
[圖]Flash+ASP實(shí)現(xiàn)電子互動(dòng)地圖在線(xiàn)標(biāo)注功能...2007-03-03C語(yǔ)言數(shù)組添加和刪除元素的實(shí)現(xiàn)
這篇文章主要介紹了C語(yǔ)言數(shù)組添加和刪除元素的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-02-02