如何在 HTML 标签属性中包含换行符?
例如:
<a href="somepage.html" onclick="javascript: foo('This is a multiline string.
This is the part after the newline.')">some link</a>
编辑:对不起,不好的例子,如果标签碰巧不在javascript中,说:
<sometag someattr="This is a multiline string.
This is the part after the newline." />
编辑2:原来字符串中的换行符不是我的问题,它是我调用的javascript函数。FWIW, "
" 可用于 HTML 属性中的换行符。