<!-- [if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><!-- [if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing> <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery> <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:SpaceForUL/> <w:BalanceSingleByteDoubleByteWidth/> <w:DoNotLeaveBackslashAlone/> <w:ULTrailSpace/> <w:DoNotExpandShiftReturn/> <w:AdjustLineHeightInTable/> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:UseFELayout/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!-- [if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!-- [if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]-->
浅谈 Assic 及回车换行 davy lee,2012-08-21
ASSIC 是基于拉丁字母的一套计算机编码系统,应用广泛,对英文支持良好。接下来,让我们看一下可能用到 ASSIC 码的场景。
一、 web 页面上直接书写 ASSIC 。
比如:
字符 ASSIC
你: 你
回车 (\r) :
换行 (\n) :
(1) 让某些属性折行显示:
① <textarea>aaaa bbbb cccc</textarea> :
② <input name="" type="text" value="aaaa bbbb cccc"/> ,这个无法折行,效果如图:
③ <a href="#" title="aaaa bbbb cccc"> 你好 </a> ,可以折行显示。
(2) Javascript 无法使用之,在 js 里换行不要使用 而应该使用 \r\n ;
① alert(“你 你”) :原样输出。
② alert(“ 你好! \n 谢谢 ”); 输出:
二、 字符转换成 ASSIC
(1) 获取某字符的 ASSIC, 代码如下
<script language=”javascript”>
Var test = “ 你好 ABCD”;
Alert(test.charCodeAt(0));// 输出的就是 ASSIC;
</script>
三、 ASSIC 转成字符
在页面上直接写上 你 ;显示的就是一个汉字“你”。