Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

prevent events to firing...

Status
Not open for further replies.

lovekang

Programmer
Feb 16, 2006
86
KR
<html>
<head>
<title>Untitled Document</title>
</head>
<body onload="document.releaseCapture()">
<input onmouseover="alert('over');" onclick="alert('click')" type="text" value="aaaaaaaaaaaa"/>
<input onmouseover="alert('over');" onclick="alert('click')" type="text" value="bbbbbbbbbbbb"/>
</body>
</html>

I have a document which consumes lots of cpu and memory.
that's because I use javascript dom. I think.

when I move mouse just a bit, it demands cpu. so I want prevent it from capturing my mouse events other than the onclick event of the input boxes.

I mean I want the code above, just onclick event is supposed to work and on mouse event is not supposed to work.

what's wrong?
 
Take out the onmouseover event handlers. And you can removed the onload statement unless you specifically want it there for something.

Lee
 
Are you trying to override events on a page that you do not create the HTML for by including your own code within an include or .js file?

If not then surely you would just remove the mouse events from your elements directly and not worry about it.

I am not sure if setting a document level event handler could prevent the element level ones from firing but you could play around with the order in which events fire. It is possible to cancel the execution of one event by causing another to occur that takes higher precedence. It would be a convoluted process though and would not really save you any CPU time.

If the document you are loading is not your own but is loaded within the same domain it is possible that you can use code to retrieve the content of that page, parse out any event handlers you do not want and then render the rest to the page directly. You would essentially be filtering out any parts of the page you do not want to be rendered.


At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top