如何在提示框中添加换行 |
您所在的位置:网站首页 › alert里面的内容换行 › 如何在提示框中添加换行 |
如何在提示框中添加换行
为了在 提示框 的内容中添加换行,我们将使用 \n 反斜杠(n)符号。 示例1: 此示例在 提示框 的文本中的两行之间添加 \n 。 GeeksforGeeksClick on the button to pop alert box with added new line. click here var text = "This is line 1\nThis is line 2"; function gfg_Run() { alert(text); }输出: 示例2: 这个示例在文本 警报框 的3行之间添加了 \n 。 GeeksForGeeksClick on the button to pop alert box with added new line. click here var text = "This is first line\nThis is "+ "middle line\nThis is last line"; function gfg_Run() { alert(text); }输出: |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |