Javascript警报

Javascript警报,javascript,alertify,Javascript,Alertify,我有一个htm表格,位置和问题供用户回答 <table id="position_holder"> <tbody> <tr> <td>СБ</td> <td> <a id="6" href="/position-holder/#">Руководитель службы СБ</a>

我有一个htm表格,位置和问题供用户回答

<table id="position_holder">
    <tbody>
        <tr>
            <td>СБ</td>
            <td>
            <a id="6" href="/position-holder/#">Руководитель службы СБ</a>
                <div class="question">Имеете ли вы высшее образование?</div>
                <div class="question">Ваш стаж работы по специальности не менее 5 лет в правоохранительных органах ?</div>
                <div class="question">Ваш возраст от 25 до 50 лет?</div>
            </td>
        </tr>
        <tr>
            <td>Отдел безопасности объектов СБ</td>
            <td>
            <a id="7" href="/position-holder/#">Начальник отдела</a>
            </td>
        </tr>
        <tr>
            <td>ДБиОТ, ООС и ОЗ</td>
            <td>
            <a id="8" href="/position-holder/#">Директор ДБиОТ, ООС и ОЗ</a>
            <div class="question">Ваш возраст от 25 до 50 лет?</div>
                <div class="question">Ваш стаж работы по специальности не менее 5 лет (в нефтяной промышленности на руководящих должностях)?</div>
                <div class="question">Ваш стаж работы в текущей должности не менее 2 лет?</div>
                <div class="question">Есть ли у Вас в наличии высшее профессиональное (техническое)образование?</div>
                <div class="question">Ваша текущая должность в АО "КБМ", согласно оргструктуре, находится на одну ступень ниже либо является аналогичной в другом подразделении?</div>
            </td>
        </tr>
        <tr>
            <td>ДБиОТ, ООС и ОЗ</td>
            <td>
            <a id="9" href="/position-holder/#">Ведущий специалист гражданской обороны</a>
            </td>
        </tr>
    </tbody>
</table>
它工作得很好。我需要一些数据来确认和提醒信息

我用图书馆来保存它

警报看起来不错,但我不知道如何实现它


我无法设置
如果(!alerify.confirm($(this).text()){
它不工作,甚至要做它抛出循环,请帮助!

最后我自己做

        $('#position_holder td a').on('click', function(){
            if($(this).next().text() == ''){
                alertify.alert('No test here yet!');
                return false;
            }
            var questions = $(this).parents("td").find(".question").toArray();
            var posId = $(this).attr('id');
            answerTheQuestion(questions, questions.length, 0, posId);
            return false;
        });

        function answerTheQuestion(questions, num, pos, posId){
            if(num == 0){
                alertify.alert('Test done!');
                return false;
            }
            console.log(questions, num, pos, posId);
            var currentQuestion = questions[pos];
            alertify.confirm($(currentQuestion).text(), function (e) {
                if (e) {
                    // user clicked "ok"
                    answerTheQuestion(questions, num - 1, pos + 1, posId);
                } else {
                    // user clicked "cancel"
                    alertify.alert('Test failed!');
                }
            });
        }

你读过如何使用alertify.confirm吗?是的,我尝试过使用alertify.confirm(消息,函数(e){如果(e){//单击确定后}或者{//单击取消后});但是它在循环中没有像我预期的那样工作,所以我需要指导我,或者给出一个使用另一个无法确认的库的方向!确认
        $('#position_holder td a').on('click', function(){
            if($(this).next().text() == ''){
                alertify.alert('No test here yet!');
                return false;
            }
            var questions = $(this).parents("td").find(".question").toArray();
            var posId = $(this).attr('id');
            answerTheQuestion(questions, questions.length, 0, posId);
            return false;
        });

        function answerTheQuestion(questions, num, pos, posId){
            if(num == 0){
                alertify.alert('Test done!');
                return false;
            }
            console.log(questions, num, pos, posId);
            var currentQuestion = questions[pos];
            alertify.confirm($(currentQuestion).text(), function (e) {
                if (e) {
                    // user clicked "ok"
                    answerTheQuestion(questions, num - 1, pos + 1, posId);
                } else {
                    // user clicked "cancel"
                    alertify.alert('Test failed!');
                }
            });
        }