Java脚本等效的VB脚本MsgBox [英] Java script Equivalent VB script MsgBox

查看:73
本文介绍了Java脚本等效的VB脚本MsgBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧的应用程序,我正在使用VB脚本MsgBox。现在我正在使应用程序Chrome兼容,其中VB脚本无法工作,所以我在下面创建一个函数



I have an old application, in which i am using VB script MsgBox. Now i am making the application Chrome compatible, in which VB script wont work, So i create a function below

function MsgBoxClass(header) {
this.returnvalue = 0;

this.modalalert = function msgBox() {
    var modalDiv = '<div id="dvModal" class="modal hide">' +
        '<div class="modal-header">' +
        '<table style="width:100%;">' +
        '<tr>' +
        '<td style="width:70%;text-align:left">' +
        '<h3 id="ModalHeader"></h3>' +
        '</td>' +
        '<td style="width:30%;text-align:right">' +
        '<a class="close" >×</a>' +
        '</td>' +
        '</tr>' +
        '</table>' +
        '</div>' +
        '<div id="dvModalBody" class="modal-body">' +
        '</div>' +
        '<div class="modal-footer" id="dvModalFooter">' +
        '<a class="btn" id="modalCancleButton" data-dismiss="modal" >Cancle</a>' +
        '<a class="btn" id="modalYesButton" data-dismiss="modal" >Yes</a>' +
        '</div>' +
        '</div>';
    $("body").append(modalDiv);
    $("#dvModalBody").html(header);
    $("#dvModal").modal({
        keyboard: false,
        backdrop: 'static',
        show: true
    });
};

this.msgBoxOkClick = function msgBoxOkClick() {
    this.returnValue = 3;
};

this.msgBoxCancleClick = function msgBoxCancleClick() {
    this.returnValue = 4;
};





并在我们的代码中使用它,



and using it in our code like this,

var messagebox = new MsgBoxClass('message');

function msgboxcall() {
        messagebox.modalalert();
        return messagebox.returnvalue;

    }





但无论按钮选择如何,它总是返回默认值O.因为执行不会停止直到用户选择按钮。



有没有什么方法可以暂停执行,直到用户点击按钮,如果他的选择?



请帮帮我。



But irrespective of button selection it always returning default value O. because execution wont halt until user selects the button.

Is there any way that i can pause the execution until user clicks on the button if his choice??

Please help me out.

推荐答案

body)。append(modalDiv);
("body").append(modalDiv);


#dvModalBody)。html(header);
("#dvModalBody").html(header);


#dvModal)。modal({
keyboard: false
背景: static'
show: true
});
};

.msgBoxOkClick = function msgBoxOkClick(){
< span class =code-keyword> this .returnValue = 3 ;
};

this .msgBoxCancleClick = function msgBoxCancleClick(){
< span class =code-keyword> this .returnValue = 4 ;
};
("#dvModal").modal({ keyboard: false, backdrop: 'static', show: true }); }; this.msgBoxOkClick = function msgBoxOkClick() { this.returnValue = 3; }; this.msgBoxCancleClick = function msgBoxCancleClick() { this.returnValue = 4; };





并在我们的代码中使用它,



and using it in our code like this,

var messagebox = new MsgBoxClass('message');

function msgboxcall() {
        messagebox.modalalert();
        return messagebox.returnvalue;

    }





但无论按钮选择如何,它总是返回默认值O.因为执行不会停止直到用户选择按钮。



有没有什么方法可以暂停执行,直到用户点击按钮,如果他的选择?



请帮帮我。



But irrespective of button selection it always returning default value O. because execution wont halt until user selects the button.

Is there any way that i can pause the execution until user clicks on the button if his choice??

Please help me out.


这篇关于Java脚本等效的VB脚本MsgBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆