?? unicode編碼轉(zhuǎn)換器.htm
字號:
<html>
<head>
<title>Unicode 編碼轉(zhuǎn)換器</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type=text/css>
body { background-color: white; margin-top: 24px; }
h1 { font: normal 20px '黑體'; text-align: center; color: black; }
td, textarea, input, select { font: normal 12px 'Courier New'; color: black; }
</style>
<script language="JavaScript">
function paste() { //粘帖
var clipboard = window.clipboardData.getData('text');
clipboard == null ? alert('您的剪切板中沒有任何文本內(nèi)容') : source.value = clipboard;
}
function A2U() { //ASCII -> Unicode轉(zhuǎn)換
if (parseFloat(ScriptEngineMajorVersion() + '.' + ScriptEngineMinorVersion()) < 5.5) { alert('您的腳本引擎版本過低,請升級為5.5以上'); return; }
if (source.value == '') { alert('文本框中沒有代碼'); return; }
result.value = '';
for (var i=0; i<source.value.length; i++)
result.value += '&#' + source.value.charCodeAt(i) + ';';
}
function U2A() { //Unicode -> ASCII轉(zhuǎn)換
var code = source.value.match(/&#(\d+);/g);
if (code == null) { alert('文本框中沒有合法的Unicode代碼'); return; }
result.value = '';
for (var i=0; i<code.length; i++)
result.value += String.fromCharCode(code[i].replace(/[&#;]/g, ''));
}
function preview() { //預(yù)覽
var win = window.open();
win.document.open('text/html', 'replace');
win.document.writeln(result.value);
win.document.close();
}
function copy() { //復(fù)制
result.value == '' ? alert('沒有需要復(fù)制的代碼') : window.clipboardData.setData('text', result.value);
}
</script>
</head>
<body>
<table width="750" align="center"><tr><td>
<h1>Unicode 編碼轉(zhuǎn)換器 1.0</h1>
<hr>
<input type="button" value="1.粘帖" onclick="paste();">(將需要進(jìn)行轉(zhuǎn)換的代碼粘帖到下面的文本框中)
<textarea style="width:750px;height:180px;" id="source"></textarea><br><br>
<hr>
2.<input type="button" value="ASCII -> Unicode" onclick="A2U();"> <input type="button" value="Unicode -> ASCII" onclick="U2A();">(點(diǎn)擊相應(yīng)格式轉(zhuǎn)換按鈕將完成代碼的轉(zhuǎn)換)
<textarea style="width:750px;height:180px;" id="result"></textarea><br><br>
<hr>
<input type="button" value="3.預(yù)覽" onclick="preview()">(查看轉(zhuǎn)換后的效果)
<img width="100" height="1">
<input type="button" value="4.復(fù)制" onclick="copy();">(復(fù)制轉(zhuǎn)換后的代碼到剪貼板中)
<br>
<hr>
</td></tr></table>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -