久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

簡(jiǎn)單的Html轉(zhuǎn)換UBB的程序

這個(gè)功能主要是讓 UBB 轉(zhuǎn)貼的時(shí)候方便點(diǎn). 

1.自動(dòng)識(shí)別圖片,超鏈接,字體顏色,和字體加粗,傾斜,下劃線的HTML代碼,并且轉(zhuǎn)換為UBB代碼.
2.兼容 IE 和 Mozilla多種瀏覽器
<html> 
<head> 
<title>Html轉(zhuǎn)換程序</title> 
<SCRIPT language="JavaScript1.2"> 
function HtmlToUBB(str) { 
str = str.replace(/r/g,""); 
str = str.replace(/on(load|click|dbclick|mouseover|mousedown|mouseup)="[^"]+"/ig,""); 
str = str.replace(/<script[^>]*?>([wW]*?)</script>/ig,""); 
str = str.replace(/<a[^>]+href="([^"]+)"[^>]*>(.*?)</a>/ig,"n[url=$1]$2[/url]n"); 
str = str.replace(/<font[^>]+color=([^ >]+)[^>]*>(.*?)</font>/ig,"n[color=$1]$2[/color]n"); 
str = str.replace(/<img[^>]+src="([^"]+)"[^>]*>/ig,"n[img]$1[/img]n"); 
str = str.replace(/<([/]?)b>/ig,"[$1b]"); 
str = str.replace(/<([/]?)strong>/ig,"[$1b]"); 
str = str.replace(/<([/]?)u>/ig,"[$1u]"); 
str = str.replace(/<([/]?)i>/ig,"[$1i]"); 
str = str.replace(/ /g," "); 
str = str.replace(/&/g,"&"); 
str = str.replace(/"/g,"""); 
str = str.replace(/</g,"<"); 
str = str.replace(/>/g,">"); 
str = str.replace(/<br>/ig,"n"); 
str = str.replace(/<[^>]*?>/g,""); 
str = str.replace(/[url=([^]]+)]n([img]1[/img])n[/url]/g,"$2"); 
str = str.replace(/n+/g,"n"); 
return str; 
} 

function trans(){ 
var str = ""; 
str = document.getElementById('edit').contentWindow.document.body.innerHTML; 
if (str.length == 0) { 
alert("無轉(zhuǎn)換內(nèi)容!請(qǐng)使用 Ctrl+V 把內(nèi)容復(fù)制到下面的編輯框內(nèi)"); 
} 
document.getElementById('ReCode').value=HtmlToUBB(str); 
} 

function clearCode(){ 
document.getElementById('ReCode').value=""; 
} 

function Start() { 
document.getElementById('edit').contentWindow.document.designMode = "on"; 
try { 
document.getElementById('edit').contentWindow.document.execCommand("undo", false, null); 
} catch (e) { 
alert("你的Mozilla瀏覽器不支持在線RichEditor"); 
} 
} 

function ViewSource(Source){ 
var Html; 
if (Source){ 
document.getElementById('sCode').value = document.getElementById('edit').contentWindow.document.body.innerHTML; 
document.getElementById('edit').style.display="none"; 
document.getElementById('sCode').style.display=""; 
document.getElementById('tip').innerText="修改粘貼后的網(wǎng)頁源代碼 >>"; 
document.getElementById('tranButton').disabled="disabled" 
} 
else{ 
document.getElementById('edit').contentWindow.document.body.innerHTML = document.getElementById('sCode').value; 
document.getElementById('edit').style.display=""; 
document.getElementById('sCode').style.display="none"; 
document.getElementById('edit').contentWindow.document.designMode = "on"; 
document.getElementById('tip').innerText="請(qǐng)使用 Ctrl+V 把內(nèi)容復(fù)制到這里 >>"; 
document.getElementById('tranButton').disabled="" 
} 
} 
</SCRIPT> 
<style> 
body{background:#688ABD;margin:2px;} 
label{color:#fff;} 
th{font-size:14px;font-family:verdana,宋體;font-weight:bold;color:fc6;text-align:left} 
#sCode{width:400;height:150px;border:1px solid #1F2F47;margin-top:0px !important;margin-top:-1px;margin-bottom:0px !important;margin-bottom:-1px;} 
#ReCode{width:400;height:150px;border:1px solid #1F2F47;font-size:12px;} 
#edit{width:398;height:148px;border:1px solid #1F2F47;background:#fff;font-size:12px} 
.input{ 
border-top:1px solid #fff; 
border-right:1px solid #003; 
border-bottom:1px solid #003; 
border-left:1px solid #fff; 
background:#F4F7FB; 
} 
.tip{ 
color:#ffc; 
font-weight:bold; 
font-size:12px; 
font-family:宋體; 
} 
</style> 
</head> 
<body onload="Start()" style=""> 
<table border="0" align="center"> 
<tr> 
<th style="">Html轉(zhuǎn)換UBB程序</th> 
</tr> 
<tr> 
<td style="font-size:12px;"> 
<label for="Source"><input type="checkbox" id="Source" onclick="ViewSource(this.checked)">查看源代碼 </label> 
<input id="tranButton" type="button" value="轉(zhuǎn) 換" onclick="trans()" class="input"> 
<input type="button" value="清 除" onclick="clearCode()" class="input"></td> 
</tr> 
<tr> 
<td class="tip"> 
<span id="tip">請(qǐng)使用 Ctrl+V 把內(nèi)容復(fù)制到這里 >></span></td> 
</tr> 
<tr> 
<td> 
<textarea id="sCode" style="display:none"></textarea> 
<iframe id="edit"src="about:blank" border="0" frameborder="0"></iframe> 
</td> 
</tr> 
<tr> 
<td class="tip"> 
轉(zhuǎn)換輸出代碼 >></td> 
</tr> 
<tr> 
<td> 
<textarea id="ReCode" readonly="readonly"></textarea> 
</td> 
</tr> 
</table> 
</body> 
</html>

【網(wǎng)站聲明】本站除付費(fèi)源碼經(jīng)過測(cè)試外,其他素材未做測(cè)試,不保證完整性,網(wǎng)站上部分源碼僅限學(xué)習(xí)交流,請(qǐng)勿用于商業(yè)用途。如損害你的權(quán)益請(qǐng)聯(lián)系客服QQ:2655101040 給予處理,謝謝支持。

相關(guān)文檔推薦

這篇文章主要介紹了有關(guān)HTML5頁面在iPhoneX適配問題,需要的朋友可以參考下
本篇文章主要介紹了html5中canvas圖表實(shí)現(xiàn)柱狀圖的示例,本文使用canvas來實(shí)現(xiàn)一個(gè)圖表,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
Adobe公司出品的多媒體處理軟件產(chǎn)品線較多,涵蓋了音視頻編輯、圖像處理、平面設(shè)計(jì)、影視后期等領(lǐng)域。這篇文章主要介紹了Adobe Html5 Extension開發(fā)初體驗(yàn)圖文教程,非常不錯(cuò),需要的朋
這篇文章主要介紹了基于HTML5的WebGL經(jīng)典3D虛擬機(jī)房漫游動(dòng)畫,需要的朋友可以參考下
這篇文章主要介紹了手機(jī)端用rem+scss做適配的詳解,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
本篇文章主要介紹了canvas 實(shí)現(xiàn) github404動(dòng)態(tài)效果的示例代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
主站蜘蛛池模板: 精品国产乱码久久久久久88av | 韩国av一区二区 | 国产在线一区二区 | 精品一区二区三区四区在线 | 亚洲欧美日韩网站 | 中日字幕大片在线播放 | 欧美xxxx色视频在线观看免费 | 国产福利视频在线观看 | 成人做爰www免费看 午夜精品久久久久久久久久久久 | 搞av.com| 97视频在线观看网站 | 中文欧美日韩 | 麻豆国产精品777777在线 | 亚洲一一在线 | 国产伦一区二区三区视频 | 精品久久久久香蕉网 | 天天草夜夜骑 | 午夜男人天堂 | 欧美free性 | 国产视频久久久久 | 99久久免费精品国产免费高清 | 综合色久 | 日韩中文字幕视频 | 日韩成人一区 | 一区二区福利视频 | 亚洲免费在线观看 | 在线免费观看一区二区 | av色站| 久久综合一区二区 | 国产精品成人一区二区三区夜夜夜 | 亚洲自拍偷拍免费视频 | 国产有码 | 亚洲日本一区二区三区四区 | 久久精品国产一区二区三区不卡 | 免费毛片网站在线观看 | 久久久久精 | 蜜桃av鲁一鲁一鲁一鲁 | 国产在线激情视频 | 亚洲综合婷婷 | 国产成人福利在线观看 | 日韩有码一区二区三区 |