![](/img/trans.png)
[英]Variable coming up as undefined when called outside of a function, but working when called inside the function
我有一個 function 創建一個 html dom modal window 帶有一個文本框和一個關閉它的按鈕。 單擊關閉按鈕時,文本框的值存儲在一個變量中。 該變量(據我所知)是全局的,並且不限於模態 window function 內部。我將其設置為當單擊關閉按鈕時,連續打開 2 個警報,均 ...