如何在javascript中更改HTML对象元素数据属性值
问题描述:
如何在 JavaScript 中更改 HTML 对象元素数据属性值?
How do you change HTML Object element data attribute value in JavaScript?
这是我正在尝试的
<object type="text/html" id="htmlFrame" style="border: none;" standby="loading" width="100%"></object>
var element = document.getElementById("htmlFrame");
element.setAttribute("data", "http://www.google.com");
答
和 jquery:
$('element').attr('some attribute','some attributes value')
即
$('a').attr('href','http://www.stackoverflow.com/')