function ReNewCaptcha(captchaKey, captchaHeight) { if (document.images['captcha'] != undefined) { var antiCache = Math.floor(Math.random()*100000); document.images['captcha'].src = "/captcha.php?get_captcha=" + captchaKey + "&height=" + captchaHeight + "&anc=" + antiCache; } } function ReNewCaptchaById(imageId, captchaKey, captchaHeight) { // Пытаемся получить скрытый объект для input-а var captchaObject = document.getElementById(imageId); // Элемента нет, добавим его if (null != captchaObject && undefined !== captchaObject) { var antiCache = Math.floor(Math.random()*100000); captchaObject.src = "/captcha.php?get_captcha=" + captchaKey + "&height=" + captchaHeight + "&anc=" + antiCache; } }