js设置title属性时如何表示换行符???
<body>
<a href= "xxxx.aspx " id= "test " title= "aaa \\naaa "> new </a>
</body>
以上能正确换行
aaa
\\naaa
当用js指定时:
<script>
window.onload=function (){
documnet.getElementById( 'test ').setAttribute( 'title ', 'now changed ');
}
</script>
</HEAD>
<body>
<a href= "xxxx.aspx " id= "test " title= "aaa \\naaa "> new </a>
</body>
</HTML>
链接的title变为了:now changed
也就是说换行关健字 此时没有起作用,请问该如何设置!
3Q
------解决方案-------------------- <script>
window.onload=function (){
document.getElementById( 'test ').setAttribute( 'title ', 'now\nchanged ');
}
</script>
</HEAD>
<body>
<a href= "xxxx.aspx " id= "test " title= "aaa \\naaa "> new </a>
</body>