Ms7 Search
Google 搜尋 翻譯
calendar
« 七月 2025 »
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
近期文章
文章分類
網站連結
Syndicate

« | »

驗證碼重新讀取

2020-11-08 @ 21:41 in PHP, JavaScript, Sql

今天在玩網頁登入加入驗證碼,可是在重新讀取時一直沒有作用,後來查網才知道,因為 src 沒有改變,所以不會重新執行

原來 img 的 jquery
$("#getcode_num").click(function(){
    $(this).prop("src", "captcha/code_num.php" ); })  
//沒有作用,因為 src =  "captcha/code_num.php" 永遠一樣.,不會改變

改成
$("#getcode_num").click(function(){
    $(this).prop("src", "captcha/code_num.php?code=" + Math.random());   });  
//改變,因為 src = "captcha/code_num.php?code=" + Math.random()); 因為 random每次改不一樣的值,code 參數隻是讓 src 不一樣,在後端不用處理

 

迴響

驗證碼重新讀取 | 豬窩

I've been explooring ffor a bit for anny hgh qujality artices orr webloog posts inn this kind oof house .
Explorting in Yaoo I at lst stumbled upon thos site.
Reading this inhfo So i'm hsppy to convey that I've a
very excellenht uncahny feeling I found out just what I needed.
I suhch a loot undoubtedly willl make sure tto don?t omit this
site andd provides iit a glance on a constaht basis.

作者 xnxxx @ 19:09, 2025-07-01
«上一篇   1 2 3
發表迴響
 authimage