开发者

return the element from a 'a' tag?

why does this not return the element? it returns the href attribute on the tag

var tst = document.body.appendChild(document.createEl开发者_C百科ement('a'));
tst.setAttribute('href', 'http://www.test.com');
alert(tst);


It does return an element..... .nodeType is 1 and .nodeName is A if you actually test it.

Anchor elements' toString method probably just return the url for certain DOM implementations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜