hallo,
ich habe folgendes script:
es geht um diese zeile
das alert vom get stimmt =1234
das alert vom else if ist auch 1234,
und da liegt der hund begraben das else if alert dürfte er garnicht anzeigen da beide 1234 sind
was ist denn hier nicht richtig
ich habe folgendes script:
Code:
// Check name /code, set cookie, show field to add chat
function setNameC(frm) {
var inputval = frm.cod.value;
$.ajax({
type: "GET",
async: false,
url: '../../ajax.php',
data: 'md5='+inputval+'&user='+userid,
success: function(data){
userpass=data;
}
});
alert(userpass);
// If name not contains only: Letters, Numbers, Space, dash, and "_", between 2 and 12 characters. Or starts /ends with space
if (chatuser.match(/^[a-z0-9 _-]{2,12}$/ig) == null || chatuser[0] == ' ' || chatuser[chatuser.length - 1] == ' ') {
alert(texts.err_name);
frm.chatuser.focus();
return false;
}
// If incorrect code
else if (frm.cod.value.length<2 || frm.cod.value != userpass) {
alert(texts.err_vcode+'f'+userpass);
document.getElementById('code_ch').style.color = 'red';
frm.cod.focus();
frm.cod.select();
return false;
}
else if (checkNameC(chatuser)==1) {
alert(chatuser+texts.err_nameused);
frm.chatuser.select();
}
// If correct code and name
else {
// Sets data for cookie
var name_cookie = 'name_c';
var val_cookie = chatuser;
var oned = 24*60*60*1000; // Cookie expiration, one day in milliseconds
var expDate = new Date();
expDate.setTime(expDate.getTime()+oned);
document.cookie = name_cookie + "=" + escape(val_cookie) + "; expires=" + expDate.toGMTString(); // sets cookie
// Hides name /code, show field to add text chat, delete the code
document.getElementById('name_code').style.display = 'none';
document.getElementById('chatadd').style.display = 'block';
frm.cod.value = '';
logoutchat = 0; // set to not delete the user from list
refresh_usrs = 0; // sets to can refresh online users list
return chatuserset = 1;
}
}
Code:
$.ajax({
type: "GET",
async: false,
url: '../../ajax.php',
data: 'md5='+inputval+'&user='+userid,
success: function(data){
userpass=data;
}
});
alert(userpass);
das alert vom get stimmt =1234
Code:
// If incorrect code
else if (frm.cod.value.length<2 || frm.cod.value != userpass) {
alert(userpass);
und da liegt der hund begraben das else if alert dürfte er garnicht anzeigen da beide 1234 sind
was ist denn hier nicht richtig
Code:
frm.cod.value != userpass