如何停止上一个/下一个按钮显示隐藏的div?

时间:2012-07-12 04:18:54

标签: javascript asp.net-mvc popup imagebutton

(ASP.NET-MVC)平台

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

有人有任何建议吗?

以下是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()”)

0 个答案:

没有答案