0
剛剛發現,改變的href動態可以有不同的實現,一個方法與爲標籤參數的一般規則動態變化
document.anchors[] =
作品Firefox和Chrome並不會同時使用
document.getElementById(..).setAttribute('href',
爲IE適用於所有人。 對於這種可以視爲理所當然的改變,還是總是有標籤/參數特定的規則?
剛剛發現,改變的href動態可以有不同的實現,一個方法與爲標籤參數的一般規則動態變化
document.anchors[] =
作品Firefox和Chrome並不會同時使用
document.getElementById(..).setAttribute('href',
爲IE適用於所有人。 對於這種可以視爲理所當然的改變,還是總是有標籤/參數特定的規則?
document.getElementsByTagName("a")
適用於所有人。
編輯:
精確的細節可以從here
讀你怎麼可以用它來獲取所有頁面的超鏈接(錨)(或框架 - 取決於window
對象上下文):
var links = document.getElementsByTagName("a");
for(var index=0; index<links.length; index++) {
// links[index].href = links[index].href + (links[index].href.indexOf("?") ? "&" : "?") + "hello";
}