→ kicksmile:呵呵好像是我搞錯了....可以access global var^^" 07/28 14:15
※ 引述《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