gpt4 book ai didi

javascript - JS点击函数没有响应

转载 作者:行者123 更新时间:2023-11-28 13:55:32 26 4
gpt4 key购买 nike

请查看此页面。我为该页面上的每个按钮(#signup_switch_btn 和 #signin_switch_btn,大红色和绿色按钮)编写了点击函数,但没有人响应。 http://tural.no-ip.org/ - 页面正在运行。 JS文件-first.js

Js 看起来像这样

$(document).ready(function () {
$('#signup_form').get(0).reset()
var counter = 0,
signin = $("#signin_switch_btn"),
signup = $("#signup_switch_btn"),
signin_f = $("#signin_form"),
holder = $("#holder"),
signup_f = $("#signup_form"),
f_container = $("#form_container");


function beforeAnimation() {
signin.removeClass('default_radius').addClass('right_radius');
signup.removeClass('default_radius').addClass('left_radius');
$("#container").animate({
marginTop: "-=150px",
}, 500);
}


$("#signup_switch_btn").click(function () {

if (counter === 0) {
beforeAnimation();
holder.css('backgroundColor', '#f91c06').height(275).slideDown("slow");
f_container.show();
signup_f.stop(true, true).fadeIn(1200);
} else {
holder.stop(true, true).animate({
height:"275",
backgroundColor:"#f91c06"
},1000);
signin_f.stop(true, true).fadeOut(1000);
f_container.stop(true, true).animate({
height:"260"
},1000);
signup_f.stop(true, true).fadeIn(1000);
}
counter++;
});

$("#signin_switch_btn").click(function () {
if (counter === 0) {
beforeAnimation();
holder.css('backgroundColor', '#5bd300').height(125).slideDown("slow");
f_container.show();
signin_f.stop().fadeIn(1200);
} else {
holder.stop(true, true).animate({
height:"125",
backgroundColor:"#5bd300"
},1000);
signup_f.stop(true, true).fadeOut(800);
f_container.stop(true, true).animate({
height:"110"
},1000);
signin_f.stop(true, true).fadeIn(1200);

}

counter++;
});

$('input[type="text"],input[type="password"]').focus(function () {
labelFocus(this, true);
}).blur(function () {
labelFocus(this, false);
});

function labelFocus(el, focused) {
var name = $(el).attr('name');
$('label[for="' + name + '"]').toggleClass('focused', !! focused);
}
$('input[type="text"],input[type="password"]').keypress(function () {
$(this).attr('class', 'valid');
});

});

最佳答案

该页面中不存在 ID 为 signup_switch_btn 的元素。因此以下绑定(bind)将永远不起作用:

$("#signup_switch_btn").click

关于javascript - JS点击函数没有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8129395/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com