Html轉(zhuǎn)換程序 /ig,””); str = str.replace(/]+href=”([^”]+)”[^>]*>(.*?)/ig,”n[url=$1]$2[/url]n”); str = str.replace(/]+color=([^ >]+)[^>]*>(.*?)/ig,”n[color=$1]$2[/color]n”); str = str.replace(/]+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(//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)”); return } document.getElementById(‘ReCode’).value=HtmlToUBB(str); document.getElementById(‘insert’).disabled=false } function doHtmlinsert() { if (document.getElementById(‘ReCode’).value==””) {alert(“你沒有進(jìn)行代碼轉(zhuǎn)換,無法插入.”);return} opener.AddText(document.getElementById(‘ReCode’).value) window.close() } 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)頁(yè)源代碼 >>”; 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=”” } } Html轉(zhuǎn)換UBB程序 查看源代碼 請(qǐng)使用 Ctrl+V 把內(nèi)容復(fù)制到這里 >> </textarea> 轉(zhuǎn)換輸出代碼 >> </textarea> [Ctrl+A 全選 注:如需引入外部Js需刷新才能執(zhí)行]