0
我正在java.lang.AssertionError: null
錯誤此代碼:DOM.getElementById總是NULL?
usernameTextBox = TextBox.wrap(DOM.getElementById("username"));
passwordTextBox = TextBox.wrap(DOM.getElementById("password"));
這裏是我的GWT HTML文件的代碼,有nocache.js
:
編輯:
而且曾嘗試:
Document.get().getElementById("username")
Document.get().getElementById("password")
仍然NULL。
很酷。謝謝。它現在可以工作,但是我必須將從type =「password」中的html更改爲 – xybrek 2012-01-15 06:19:21
他在哪裏獲取'document'實例?此外,單引號用於字符,字符串使用雙引號。你的代碼不能編譯。 OP在訪問密碼框時遇到問題,因爲JavaScript無法訪問密碼類型的輸入框。 – 2012-01-15 09:46:13
嗯,我剛剛意識到你寫了javascript,而OP用Java/GWT寫入。 – 2012-01-15 10:22:04