首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

js设置title属性时怎么表示换行符?

2012-02-09 
js设置title属性时如何表示换行符???bodyahref xxxx.aspx id test title aaa\\naaa new /a

js设置title属性时如何表示换行符???
<body>
<a   href= "xxxx.aspx "   id= "test "   title= "aaa&#13;\\naaa "> new </a>
</body>

以上能正确换行

aaa
\\naaa

当用js指定时:
<script>
                        window.onload=function   (){
                                documnet.getElementById( 'test ').setAttribute( 'title ', 'now&#13;changed ');
                        }
</script>
</HEAD>
<body>
<a   href= "xxxx.aspx "   id= "test "   title= "aaa&#13;\\naaa "> new </a>
</body>
</HTML>

链接的title变为了:now&#13;changed

也就是说换行关健字&#13;此时没有起作用,请问该如何设置!

3Q

[解决办法]
<script>
window.onload=function (){
document.getElementById( 'test ').setAttribute( 'title ', 'now\nchanged ');
}
</script>
</HEAD>
<body>
<a href= "xxxx.aspx " id= "test " title= "aaa&#13;\\naaa "> new </a>
</body>

热点排行