admin管理员组文章数量:1415138
I'd like to add to my <td>
element JS event listener that will be triggered when the page is rendered (or loaded) to the DOM and the TD contains its innerHTML value.
something like:
<script>
function manipulate(field){
field.value = field.value+'_done';
}
</script>
<td onRender=manipulate(this)>Hello World</td>
I can't use onLoad because it can be used in <body>
only to my understanding
Is there any way to do it?
I'd like to add to my <td>
element JS event listener that will be triggered when the page is rendered (or loaded) to the DOM and the TD contains its innerHTML value.
something like:
<script>
function manipulate(field){
field.value = field.value+'_done';
}
</script>
<td onRender=manipulate(this)>Hello World</td>
I can't use onLoad because it can be used in <body>
only to my understanding
Is there any way to do it?
-
The "global"
onload
event triggers only after everything is loaded, and this includes your table cell. What's wrong with that? – user447356 Commented Apr 12, 2011 at 9:56
2 Answers
Reset to default 1You can still use the body's onload, it will fire when the plete page is ready and loaded. You can set an attribute for every TD element you'd like to manipulate, and then traverse the page to find those elements and call your function.
Why do you want to manipulate something after the DOM is loaded?
You don't have to attach the onLoad event to the body. You can use the global event handler like this:
function init() {
//Your function call
}
window.onload = init;
本文标签: htmlLooking for javascript event equivalent to 39onRender39Stack Overflow
版权声明:本文标题:html - Looking for javascript event equivalent to 'onRender' - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745219356a2648317.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论