0

(ASP.NET-MVC) 平台

我有一个弹出对话框,在标题中还有上一个/下一个按钮,可以在不关闭弹出窗口的情况下循环浏览一系列不同的对话框。工作正常,但是在第一个隐藏的弹出 div 之前有隐藏的 div,并且当显示第一个(想要的)隐藏 div 并且我单击 prev 时,上一个按钮正在显示不需要的隐藏 div……有意义吗?

有没有人有什么建议?

这是 HTML 的示例:

<div class="uptitle">
    <img src="/Images/btnLeftArrow.png" onclick="GetPreviousAttachmentQuestion()" style="margin: 0 0 -4px 0;" alt="">
    <label id="AttachmentSurveyDataId" hidden=""></label>
    <label id="AttachmentInputFieldId" hidden=""></label>
    <label id="AttachmentPropertySurveyId" hidden=""></label>
    <h3 style="display: inline"><span data-bind="text: FieldLabel"></span></h3>
    <img src="/Images/btnRightArrow.png" onclick="GetNextAttachmentQuestion()" style="margin: 0 0 -4px 0;" alt="">
    <br>
    <br>                   
</div>

这是Javascript:

var GetPreviousAttachmentQuestion = function () {
    var currentSurveyDataId = $('#AttachmentSurveyDataId').text();
    if (currentSurveyDataId != "") {
        var currentDiv = $('div > input[value="' + currentSurveyDataId + '"]').closest($('div'));
        var previousQuestion = $(currentDiv).prev($('div > img[onclick^="PopAddPhotosDialog"]'));

        if ($('#AttachmentSurveyDataId').text() == "Front View")
            previousQuestion.attr('disabled', 'disabled');

        else if (previousQuestion.length == 0)
            return;

        var previousSurveyId = ($('input[name^="SurveyDatas"][name$=".Id"]', previousQuestion.closest($('div')))).val();
        var previousInputFieldId = $('input[name^="SurveyDatas"][name$=".InputField_Id"]', previousQuestion).val();
        var propertySurveyId = $('#AttachmentPropertySurveyId').text();
        SetupAddPhotosWidget(previousInputFieldId, previousSurveyId, propertySurveyId);
    }
};

(下一个按钮是相同的,除了它使用“.next()”)

4

0 回答 0