Category 活动攻略

之前习惯性写过这样的方法来获取a标签的值

预约

其中的原因是alert(obj)可以看成alert(obj.toString())因为打印的是字符串 内部其实是调用 toString()方法

a元素的toString()方法和别的元素不一样

a元素的toString()方法默认是

window.HTMLAnchorElement.prototype.toString = function () {

return this.getAttribute("href");

}

所以a标签通过这种方式是不能获取到value值的

但是对于其它的元素,这种方式是可行的

Copyright © 2088 炎龙游戏攻略网 - 活动副本全解析 All Rights Reserved.
友情链接
top