Title: Javascript problem in Firefox. Post by: r3wt on June 20, 2013, 11:55:21 AM Ok, i'm having problem getting this to work in firefox
this is a captcha i made using a devshed tutorial. this function is used to reload. Code: <script type="text/javascript">function reloadCaptcha() i'm using the following to call the function in an href Code: <a href="" onclick="reloadCaptcha();"></a> this works perfect in chrome and in ie as well. however i can't get it to work in firefox. as a work around, i'm using Code: return: false;" Code: <a href="" onclick="reloadCaptcha(); return: false;"> i need to find a work around for this in 5 days or less. The site is ready for production and the owner has signed off on it, but i think i could do this a little better. i don't know much about ajax or jquery. i need a crash course or atleast a work around for this problem. r3wt Title: Re: Javascript problem in Firefox. Post by: RoadToHell on June 20, 2013, 03:07:56 PM should be
return false; not return: false; That should prevent the page reload. If not, try using setTimeout to call reloadCaptcha in the onclick attribute. Title: Re: Javascript problem in Firefox. Post by: r3wt on June 21, 2013, 03:52:42 AM should be return false; not return: false; That should prevent the page reload. If not, try using setTimeout to call reloadCaptcha in the onclick attribute. ok, thanks for the response. i will try your suggestions. edit: i tried both methods, even with placing the reloadCaptcha inside the setTimeout but its still giving the same result but with it seems to be decreasing page load speeds Title: Re: Javascript problem in Firefox. Post by: rethaw on June 21, 2013, 04:18:43 AM What about it doesn't work? Not to be snarky but why are you asking here and not stackoverflow?
Maybe try putting a # in your href. Code: <a href="#" onclick="reloadCaptcha();"></a> Title: Re: Javascript problem in Firefox. Post by: 🏰 TradeFortress 🏰 on June 21, 2013, 04:23:12 AM <a href="#" onclick="reloadCaptcha()">
No ; at the end. Better way if you want to use jQuery: $("#linkid").click(reloadCaptcha); Title: Re: Javascript problem in Firefox. Post by: RoadToHell on June 21, 2013, 02:06:56 PM If "return false;" is not preventing the page reload then an error is occurring in the javascript that executes before it reaches the return statement.
|