怎么让特殊字符在文本文档中正确显示?2
发布网友
发布时间:2023-11-08 09:48
我来回答
共1个回答
热心网友
时间:2024-12-15 05:10
给你一段特殊代码对应表。在本地建个文本文件,拷贝以下内容,之后改文件格式为html。就可以看了。
<html>
<head>
<title>Special characters
</title>
<script language="javascript">function writeChars()
{
var tds = 22;
var str = "";
for (var i = 33; i < 256; )
{
document.write('<tr>');
for (var j = 0; j <= tds; j++)
{
document.write(
'<td style=\"align: left; height: 20; font-size: 12px; FONT-FAMILY: Verdana;\" bgcolor=white width=\"18\" align=center onClick=\"getchar(this)\" onmouseover=\"spcOver(this)\" onmouseout=\"spcOut(this)\" title=\"' + i + ';\" >');
document.write('' + i + ';');
document.write('</td>');
i++;
}
document.write('</tr>');
}
;
}
function spcOver(el)
{
el.style.background = "#0A246A";
el.style.color = "white";
}
function spcOut(el)
{
el.style.background = "white";
el.style.color = "black";
}
function getchar(obj)
{
if (!obj.innerHTML)
return;
document.all.char.value = "" + obj.title || "";
}
function cancel()
{
window.returnValue = null;
window.close();
}
</script>
</head>
<body bgcolor="buttonface">
<form id="Insert_chart" method="post" runat="server">
<table border="0" cellspacing="2" cellpadding="2" width="96%" align="center">
<tr>
<td align="center">
<fieldset style="padding-bottom:5px" align="center" style="font-family: MS Sans Serif; font-size: 9pt; vertical-align: middle; cursor: hand;">
<legend>
Special characters
</legend>
<br>
<TABLE width="95%" cellspacing="1" cellpadding="1" border="0" bordercolor="dimgray" align="center" bgcolor="dimgray">
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
writeChars();
-->
</SCRIPT>
</TABLE>
</fieldset>
</td>
</tr>
<tr>
<td align="right">
<input type="text" id="char" />
<BUTTON style="font-family: MS Sans Serif; font-size: 9pt; vertical-align: middle; cursor: hand; font-size: x-small;" type="reset" onclick="cancel()" id="button1" name="button1">
Cancel
</BUTTON>
</td>
</tr>
</table>
</form>
</body>
</html>