11

我想在 Javascript confirm() 函数中显示文本行:

第一行:¿您真的要取消手术吗?

第二行:所有输入的数据都将丢失');

$('#button').click(function () {
    return confirm('¿DO YOU REALLY WANT TO CANCEL THE OPERATION? ALL ENTERED DATA WILL BE LOST');
});​

演示:http: //jsfiddle.net/8jEZZ/

在此处输入图像描述

谢谢你。

4

3 回答 3

31

添加\n和魔法会发生!

$('#button').click(function () {
    return confirm('¿DO YOU REALLY WANT TO CANCEL THE OPERATION? \n ALL ENTERED DATA WILL BE LOST');
});​
于 2012-11-23T12:51:25.317 回答
0

尝试换行符,工作小提琴

  $('#button').click(function () {
    return confirm('¿DO YOU REALLY WANT TO CANCEL THE OPERATION?\n ALL ENTERED DATA WILL BE LOST');
});
于 2012-11-23T12:53:17.000 回答
0

使用换行符

$('#button').click(function () {
   return confirm('¿DO YOU REALLY WANT TO CANCEL THE OPERATION? \nALL ENTERED DATA WILL BE        LOST');
});​
于 2012-11-23T12:53:26.583 回答