最贊回答 / Kevinke
同學mychar是一個html element,mychar.innerHTML是獲取這個element的內部html內容,這里是一個字符串(hello world),你用document.write輸出的內容用加號連接,意思是輸出一個字符串,不用innerHTML的話,輸出的內容是:原標題:[object],而不是:原標題: hello world. 自己在瀏覽器里邊試試就知道了。
2015-04-20
已采納回答 / Perona
background 屬性在一個聲明中設置所有的背景屬性。Object.style.background=background-color background-imagebackground-repeat background-attachment background-position也就是說如果用background可以同時設置多個背景屬性。不通過是可能是因為這里只驗證有沒有backgroundColor。
2015-04-20