Javascript 当我点击弹出按钮时,它将加载,而我不';我不想要它

Javascript 当我点击弹出按钮时,它将加载,而我不';我不想要它,javascript,c#,asp.net,Javascript,C#,Asp.net,当弹出窗口出现时,我输入一个值并单击按钮。 这里的问题是,当我点击按钮时,它将加载页面,插入的值将被清除。 所以,当我点击按钮时,它不应该触发页面加载,而是应该触发我的按钮点击事件 这里有一张图片 我的主要问题是,当我点击按钮,它将加载页面,我希望它停止,我的按钮点击事件激发 按钮代码: javascript代码 `$(“.next1”)。单击(函数(){ 如果(动画)返回true; 动画=真 current_fs = $(this).parent();

当弹出窗口出现时,我输入一个值并单击按钮。 这里的问题是,当我点击按钮时,它将加载页面,插入的值将被清除。 所以,当我点击按钮时,它不应该触发页面加载,而是应该触发我的按钮点击事件

这里有一张图片

我的主要问题是,当我点击按钮,它将加载页面,我希望它停止,我的按钮点击事件激发

按钮代码:

javascript代码 `$(“.next1”)。单击(函数(){ 如果(动画)返回true; 动画=真

            current_fs = $(this).parent();
            next_fs = $(this).parent().next();

            //activate next step on progressbar using the index of next_fs
            $("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");

            //show the next fieldset
            next_fs.show();

            //hide the current fieldset with style
            current_fs.animate({ opacity: 0 }, {
                step: function (now, mx) {
                    //as the opacity of current_fs reduces to 0 - stored in "now"
                    //1. scale current_fs down to 80%
                    scale = 1 - (1 - now) * 0.2;
                    //2. bring next_fs from the right(50%)
                    left = (now * 50) + "%";
                    //3. increase opacity of next_fs to 1 as it moves in
                    opacity = 1 - now;
                    current_fs.css({ 'transform': 'scale(' + scale + ')' });
                    next_fs.css({ 'left': left, 'opacity': opacity });
                },
                duration: 800,
                complete: function () {
                    current_fs.hide();
                    animating = false;
                },
                //this comes from the custom easing plugin
                easing: 'easeInOutBack'
              // $('btnfirstnext').trigger('click');

            });
        });`
按钮点击代码:
protectedvoid btnfirstnext\u单击(对象发送方,事件参数e)
{
lbltry.text=“您好,如果使用onclientclick=false,则此代码无效”;

}

我认为您不应该使用asp.net控件
,因为当
OnClick
事件触发时,整个页面将发送回服务器以调用您在后端C代码中注册的事件处理程序,
btnfirstnext\u单击
方法,因此如果您想停止重新加载页面,可以替换
asp:按钮
或其他html标记进行code>控件,并在js代码中编写click回调函数,可能如下所示:

<!-- html -->
<a id="btnfirstnext" class="next1 action-button">Next</a>

// javascript code
$('#btnfirstnext').click(function(){
    // your logic here
});

下一个
//javascript代码
$('#btnfirstnext')。单击(函数(){
//你的逻辑在这里
});
顺便说一句,如果您认为javascript代码不能处理您的业务需求,您可以在click回调函数中发出ajax请求来调用backend的方法


希望这能有所帮助!

请您的问题显示相关代码。很难理解您的问题。请重新格式化您的问题?为什么使用类作为标识符?在完成缓解时使用Id并返回false。我使用类是因为弹出窗口