Re: [問題] 在請教一下javascript全域變數跟區域變數

看板Web_Design作者 (薛丁格的貓)時間19年前 (2006/07/28 11:18), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串2/3 (看更多)
※ 引述《kicksmile (aa)》之銘言: : javascript好像不容許在function裡讀取外面的全域變數 可以啊~~ <html><head><title> TEST </title> <script> var cun = 1; function countG(){cun += 1;return ;} </script> </head><body><button onclick='countG();alert(cun)'>test</button> </body></html> 很正常啊... .. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 202.132.72.186

07/28 14:15, , 1F
呵呵好像是我搞錯了....可以access global var^^"
07/28 14:15, 1F
文章代碼(AID): #14oO8DYc (Web_Design)
討論串 (同標題文章)
文章代碼(AID): #14oO8DYc (Web_Design)