關于 con[i].getAttribute("title") 和 ?con[i].title 區別
代碼如下: ? ?
var con=document.getElementsByTagName("li");
? ? text=con[0].getAttribute("title");
? ? text1=con[0].title;
獲取的text 和text1 這個兩個元素有什么區別哪?
代碼如下: ? ?
var con=document.getElementsByTagName("li");
? ? text=con[0].getAttribute("title");
? ? text1=con[0].title;
獲取的text 和text1 這個兩個元素有什么區別哪?
2015-03-21
舉報
2016-01-07
text獲取的是title的Key值,而text1獲取到的是title屬性本身。