?? 9-4 html編碼轉換.htm
字號:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=GB2312" />
<title>9-4 HTML編碼轉換</title>
<!-- 樣式表 -->
<style>
* { font-size:12px; font-family:宋體, Arial; } /*規定了所有的字體樣式*/
body { background-color:buttonface; border-width:0px; margin:0px; padding:5px; }
textarea { border-width:1px; width:200px; height:100px; margin-bottom:5px; }
input { border-width:1px; margin-bottom:5px; }
.output { border:1px inset buttonface; width:200px; height:100px; margin-bottom:5px; background-color:white; overflow:auto; padding:5px; }
</style>
<script>
function parseHTML(){
var str, re;
str = $("t1").value;
re = str.replace(/&/g,"&").replace(/"/g,""").replace(/ /g," ").replace(/\t/g," ").replace(/</g,"<").replace(/>/g,">").replace(/\r\n/g,"<br>");
$("t2").value = re;
$("o1").innerHTML = str;
$("o2").innerHTML = re;
}
function $(str){ return(document.getElementById(str)); }
</script>
</head>
<body style="overflow:auto;">
<table width="100%" >
<tr>
<td><b>請輸入需轉換的文本:</b></td>
<td><b>HTML編碼后的文本:</b></td>
</tr>
<tr>
<td><textarea id="t1"></textarea></td>
<td><textarea id="t2"></textarea></td>
</tr>
<tr>
<td colspan=2><input type="button" value="獲取網址" onclick="parseHTML();"></td>
</tr>
<tr>
<td><b>未編碼的演示:</b></td>
<td><b>編碼后的演示:</b></td>
</tr>
<tr>
<td><div class="output" id="o1"></div></td>
<td><div class="output" id="o2"></div></td>
</tr>
</table>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -