Hi, I''m trying to refresh an img tag that as a captcha image. <img src="captcha.php" align="absmiddle" /> How am I able to do this with prototype? Thanks N --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
You could wrap the image in another element (perhaps a span) and then update that element with a new image as necessary. - Dash - On Dec 20, 11:18 am, Nuno <nuno.f.ne...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I''m trying to refresh an img tag that as a captcha image. > > <img src="captcha.php" align="absmiddle" /> > > How am I able to do this with prototype? > > Thanks > > N--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, Here is the code: <span id="cap"><img src="visual-captcha.php" width="120" height="40" alt="Captcha" /></span> <a href="#" onClick="javascript: new Ajax.Updater(''cap'', ''visual- captcha.php'', { method: ''get'' });">Change Image</a> But it doesn''t work Any ideas? N On Dec 20, 5:32 pm, dashifen <dashi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You could wrap the image in another element (perhaps a span) and then > update that element with a new image as necessary. > > - Dash - > > On Dec 20, 11:18 am, Nuno <nuno.f.ne...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, > > > I''m trying to refresh an img tag that as a captcha image. > > > <img src="captcha.php" align="absmiddle" /> > > > How am I able to do this with prototype? > > > Thanks > > > N--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Nuno wrote:> Hi, > > I''m trying to refresh an img tag that as a captcha image. > > <img src="captcha.php" align="absmiddle" /> > > How am I able to do this with prototype? > > Thanks > > N >One way would be to change the source by adding a unique parameter that captcha.php doesn''t look at: $(myImgId).src = ''captcha.php?time='' + new Date().getTime(); - Ken Snyder --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 20, 2007 6:38 PM, Nuno <nuno.f.neves-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > Here is the code: > > <span id="cap"><img src="visual-captcha.php" width="120" height="40" > alt="Captcha" /></span> > <a href="#" onClick="javascript: new Ajax.Updater(''cap'', ''visual- > captcha.php'', { method: ''get'' });">Change Image</a> > >I think you need to change the source of the image. something like: $(''my_image'').src = ''url_to_image''; Maybe is better to create an Image object and set the source when the image is loaded. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Ok, I solve it this way: <img name="captcha" src="visual-captcha.php" width="120" height="40" alt="Captcha" /></span> <a href="#" onClick="javascript: document.images[''captcha''].src ''visual-captcha.php?'' + Math.random();">Change Image</a> I''m not a Javascript man, so .. it works What do you think? Does this works on every browser? Thanks N On Dec 20, 5:41 pm, "Andrea Franz" <franz.and...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Dec 20, 2007 6:38 PM, Nuno <nuno.f.ne...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi, > > > Here is the code: > > > <span id="cap"><img src="visual-captcha.php" width="120" height="40" > > alt="Captcha" /></span> > > <a href="#" onClick="javascript: new Ajax.Updater(''cap'', ''visual- > > captcha.php'', { method: ''get'' });">Change Image</a> > > I think you need to change the source of the image. something like: > > $(''my_image'').src = ''url_to_image''; > > Maybe is better to create an Image object and set the source when the image > is loaded.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---