重构artDialog.prompt方法,让它支持多行文本

  artDialog.prompt = function (content, yes, value) {
            value = value || '';
            var input;

            return artDialog({
                id: 'Prompt',
                icon: 'question',
                fixed: true,
                lock: true,
                opacity: .1,
                content: [
            '<div style="margin-bottom:5px;font-size:12px">',
                content,
            '</div>',
            '<div>',
                '<textarea cols=30 rows=5>' + value + '</textarea>',
            '</div>'
            ].join(''),
                init: function () {
                    input = this.DOM.content.find('textarea')[0];
                    input.select();
                    input.focus();
                },
                ok: function (here) {
                    return yes && yes.call(this, input.value, here);
                },
                cancel: true
            });
        };

       // 调用
        artDialog.prompt("ok", function (data) { alert(data); }, "ok1");

posted @ 2012-02-14 13:36  张占岭  阅读(1983)  评论(0编辑  收藏  举报