我有以下代码通过它的属性获取元素:document.getElementsByAttribute("xlink:href",id);我收到这个错误:UncaughtTypeError:document.getElementsByAttributeisnotafunction我不明白怎么回事,这不是标准的chrome功能吗? 最佳答案 来自documentation:NotethatthismethodisonlyavailableonXULelements;itisnotpartoftheW3CDOM.使用这个:document.