gpt4 book ai didi

Javascript 在 html 页面上创建新行?

转载 作者:行者123 更新时间:2023-12-02 20:14:13 25 4
gpt4 key购买 nike

我有一个 javascript 函数,当用户单击按钮时,它会打印一些文本框。

但是,当用户多次单击按钮时,文本框只会沿着页面移动,但我希望每次调用函数时它总是换行。

我试过了

x=document.write ('<br/>');
document.getElementById('txtara').appendChild(x)

但这只会将我的页面清除为空白。

谢谢

最佳答案

document.getElementById ('txtara').innerHTML += '<br>';

关于Javascript 在 html 页面上创建新行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6539416/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com