我从db得到一个值。我希望如果值为1则显示绿色圆圈,如果为0则显示红色圆圈。
var online= $("#online").val();
if (online = 1) {
online = RGBColour(255, 0, 0);
} else {
online = RGBColour(0, 255, 0);
}
答案 0 :(得分:1)
您正在设置值而不检查值。你需要检查==或===,如下所示:
if(mob_or_email==""){
document.getElementById('busp_email').innerHTML="Mobile/Email required";
$("#busp_email").removeClass('field_validation_error hidden');
$("#busp_email").addClass('field_validation_error');
$("#busi_name").css("color","#f42156");
}
if($('#login_password').val()==""){
document.getElementById('logp_pwd').innerHTML="Password required";
$("#logp_pwd").removeClass('field_validation_error hidden');
$("#logp_pwd").addClass('field_validation_error');
$("#log_pwd").css("color","#f42156");
}
答案 1 :(得分:0)
替换
if (online = 1) {
带
if (online == 1) {