[英]JS click function doesn't respond
Please take a look at this page. 请看一下这个页面。 I wrote click functions for each button (#signup_switch_btn and #signin_switch_btn, the big red and green ones) on this page but no one responds.
我在此页面上为每个按钮(#signup_switch_btn和#signin_switch_btn,红色和绿色的大按钮)编写了单击功能,但是没有人响应。 http://tural.no-ip.org/ - Page in action.
http://tural.no-ip.org/-实际页面。 JS file - first.js
JS文件-first.js
Js looks like this 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');
});
});
No element with an id of signup_switch_btn
exists in that page. 该页面中
signup_switch_btn
存在ID为signup_switch_btn
元素。 Therefore the following binding will never work: 因此,以下绑定将永远无法工作:
$("#signup_switch_btn").click
Your id on the html page are signing and signup. 您在html页面上的ID正在签名和注册。 Change $('#signup_switch_btn') to $('#signup')
将$('#signup_switch_btn')更改为$('#signup')
There are no buttons with id *signin_switch_btn* and *signup_switch_btn*. 没有ID为* signin_switch_btn *和* signup_switch_btn *的按钮。 Your button's ids are signin and signup .
您按钮的ID为signin和signup 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.