js里面的空格输出的两种方式:
1.使用输出html标签 来解决.
document.write("
"+"A"+"
"+"B");结果: A B登录后复制
2.在输出时添加“white-space:pre;”样式属性。这个样式表示"空白会被浏览器保留".
document.write("<span style ='white-space:pre;'>+" A B"+"</span>");登录后复制结果: A B登录后复制
以上就是JavaScript 两种空格输出方式是什么的详细内容,更多请关注php中文网其它相关文章!
Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号