原文:Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.

今天復習了一下關於getComputedStyle的用法,遇到了小小的挫折。報錯前的代碼: 當然,這只是隨便舉的例子,然而卻遇到了標題上面的報錯,糾結了一會后,終於解決了。原來是獲取dom元素時,應該通過標簽中的id屬性去獲取,這樣僅需要改為 var box document.getElementById box 就OK啦,是不是很簡單。 ...

2019-07-15 23:08 0 3957 推薦指數:

查看詳情

 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM