English 中文(简体)
• 如何拦截 j壁字母的超文本改动?
原标题:how to intercept innerHTML changes in javascript?

我需要在我的网页上拦截对囚室内容的任何改动。

下面的法典显示,增加生计的人不工作。

function modifyText() {
alert("!");
}

var el=document.getElementById("mycell");
el.innerHTML="a"
el.addEventListener("change", modifyText, false); 
// After next instruction I expect an alert message but it does not appear...
el.innerHTML="Z";

The code is just a toy example. In my real case the changes in the page (and therefore in the cell, too) are made by a webapp that I have NO control over.

最佳回答

You can t listen to a DOM element change that way. change event is mostly for inputs

还有其他一些新的3号OMOMS事件,将有助于你实现这一点。

这里有一些:

/ 草案

问题回答

参看。 探测/监测OM变化的最有效方法? 帮助?

似乎有100%的交叉浏览器解决方案,而工作的一个方面是污染感兴趣的因素,看看它们是否是静默的。 时间变化





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签