我使用JavaScript創建一個新的窗口,在該窗口中創建元素, 當我嘗試使用ID使用該元素,我不能做到這一點,並採取空值使用JavaScript創建元素,並使用它
var unit_Window = window.open("", '',"height=400,width=400,status=yes");
unit_Window.document.write("<label id='title_ID'>title</label></center>");
現在,當我嘗試使用ID值回拿到冠軍值爲null
unit_Window.document.getElementById('title_ID');
你正在使用'getElementById',它會回報你的整個元素本身不只是標題 – 2015-02-09 10:09:01
嘗試'unit_Window.document.getElementById(「的title_id」)。innerHTML' – 2015-02-09 10:10:57
我知道@NirbhayKundan但我意思是unit_Window.document.getElementById('title_ID')必須返回對象元素,但目前返回null – 2015-02-09 10:14:54