jquery - Update 2 exact same images source using javascript -


possible duplicate:
update 2 exact same images source using javascript

i using php captcha called cryptographer captchan.fr site

i need use 2 captcha on same page have problem generated when click refresh first 1 refreshes, refresh code looks this.

document.images.captcha.src='cryptographp.html?cfg=0&&'+math.round(math.random(0)*1000)+1; 

i tried code works first 1 anyway

document.getelementbyid('captcha').src='cryptographp.html?cfg=0&&'+math.round(math.random(0)*1000)+1; 

now wanted added name="captcha" image not work reason can me fix it?

document.getelementsbyname('captcha').src='cryptographp.html?cfg=0&&+math.round(math.random(0)*1000)+1; 

i have jquery attached page if thats easier.

i tried remove id , use class still nothing

$('.captcha').src='cryptographp.html?cfg=0&&'+math.round(math.random(0)*1000)+1; 

because saying undefined reference.

you're there! need use .attr in jquery, there no .src method

$('.captcha').attr('src', 'cryptographp.html?cfg=0&&'+math.round(math.random(0)*1000)+1); 

ensure 2 <img> has class captcha


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -