A new, object-oriented, better vesion of μForum
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

62 lines
1.2 KiB

var ajax;
function init() {
initAjax();
}
function initAjax() {
try
{
ajax = new XMLHttpRequest();
}
catch(e) // IE <= 6
{
var XmlHttpVersions = [
'MSXML2.XMLHTTP.6.0',
'MSXML2.XMLHTTP.5.0',
'MSXML2.XMLHTTP.4.0',
'MSXML2.XMLHTTP.3.0',
'MSXML2.XMLHTTP',
'Microsoft.XMLHTTP'
];
for (var i=0; i < XmlHttpVersions.length && null === ajax; i++)
{
try
{
ajax = new ActiveXObject(XmlHttpVersions[i]);
} catch (e) {}
}
if (null === ajax)
{
throw new Error('AJAX Error');
}
}
return true;
}
function response() {
if (ajax.readyState != 4 || ajax.status != 200)
return;
if (ajax.responseText == 'true')
{
document.getElementById('nick-inuse').style.display = 'inline';
document.getElementById('nick-free').style.display = 'none';
}
else
{
document.getElementById('nick-inuse').style.display = 'none';
document.getElementById('nick-free').style.display = 'inline';
}
}
function checkNick() {
if (ajax == null)
init();
if (document.getElementById('nick').value == '') return 0;
ajax.onreadystatechange = response;
ajax.open('GET', 'index.php?mode=checknick&nick=' + document.getElementById('nick').value);
ajax.send(null);
}