濮阳杆衣贸易有限公司

主頁 > 知識庫 > asp下實現(xiàn)代碼的“運行代碼”“復(fù)制代碼”“保存代碼”功能源碼

asp下實現(xiàn)代碼的“運行代碼”“復(fù)制代碼”“保存代碼”功能源碼

熱門標(biāo)簽:西寧公司外呼系統(tǒng)平臺 騰訊地圖標(biāo)注商戶關(guān)閉 徐州人工智能電銷機(jī)器人好用嗎 地圖標(biāo)注宅基地 武漢營銷電話機(jī)器人軟件 外呼系統(tǒng)還用卡么 智能電銷機(jī)器人適用于哪些行業(yè) 地圖標(biāo)注服務(wù)哪家好 長沙防封電銷卡品牌
Function content_Code(Str)
dim ary_String,i,n,n_pos
ary_String=split(Str,"[ code ]")
n=ubound(ary_String)
If n1 then
content_Code=Str
Exit function
End If
for i=1 to n
n_pos=inStr(ary_String(i),"[/ code ]")
If n_pos>0 then
ary_String(i)="br />textarea class=gocode id=runcode"i" name=runcode"i">" server.HTMLEncode(left(ary_String(i),n_pos-1))"/textarea>br />input type=button class=input-code value=運行代碼 onclick=runCode(runcode"i")>input type=button class=input-code value=復(fù)制代碼 onclick=copycode(runcode"i")>input type=button class=input-code value=另存代碼 onclick=saveCode(runcode"i")>span class=code-tishi>提示:您可以先修改部分代碼再運行/span>br />" _
right(ary_String(i),len(ary_String(i))-n_pos-6)
Else
ary_String(i)="[code]" ary_String(i)
End if
next
content_Code=join(ary_String,"")
End Function

使用方法也很簡單:
發(fā)表文章時需用使用“運行代碼”功能的,主要前后加上
[ code ][/ code ]
比如:
[復(fù)制此代碼]CODE:
[ code ]
script type="text/javascript">
alert("簡單吧");
/script>
[/ code ]
需要注意的是,在顯示的頁面要進(jìn)入以下javascript:

function runCode(obj) {
var winname = window.open('', "_blank", '');
winname.document.open('text/html', 'replace');
winname.opener = null
winname.document.writeln(obj.value);
winname.document.close();
}
function copycode(obj) {
var rng = document.body.createTextRange();
rng.moveToElementText(obj);
rng.scrollIntoView();
rng.select();
rng.execCommand("Copy");
rng.collapse(false);
}
function saveCode(obj) {
var winname = window.open('', '_blank', 'top=10000');
winname.document.open('text/html', 'replace');
winname.document.write(obj.value);
winname.document.execCommand('saveas','','code.htm');
winname.close();
}

標(biāo)簽:雅安 普洱 巴彥淖爾 運城 荊門 通化 通遼 鷹潭

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《asp下實現(xiàn)代碼的“運行代碼”“復(fù)制代碼”“保存代碼”功能源碼》,本文關(guān)鍵詞  asp,下,實現(xiàn),代碼,的,運行代碼,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《asp下實現(xiàn)代碼的“運行代碼”“復(fù)制代碼”“保存代碼”功能源碼》相關(guān)的同類信息!
  • 本頁收集關(guān)于asp下實現(xiàn)代碼的“運行代碼”“復(fù)制代碼”“保存代碼”功能源碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    谢通门县| 南皮县| 罗田县| 阳朔县| 清水河县| 西畴县| 珲春市| 衡南县| 通辽市| 乌拉特中旗| 万载县| 乌海市| 修文县| 阿拉善左旗| 彭阳县| 渭南市| 平乡县| 泰和县| 伊宁县| 定州市| 博兴县| 衡水市| 彭州市| 苗栗市| 阳泉市| 德惠市| 绩溪县| 会宁县| 彰化县| 湄潭县| 万宁市| 岳阳市| 景德镇市| 东海县| 甘孜| 阳江市| 治县。| 洛隆县| 蒙阴县| 平武县| 思茅市|