var alltext, thistext;
alltext = document.evaluate(
'//*[@onkeypress]',
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (var i = 0; i < alltext.snapshotLength; i++) {
thistext = alltext.snapshotItem(i);
thistext.onkeypress = "";
}
This obviously doesnt work. I havent a clue how to change the
onkeypress event attribute of the textarea automatically whenever the
page loads.
Can anyone help me please?
This is the entire textarea code
<TEXTAREA NAME="body" ROWS="18"
COLS="70" WRAP="virtual"
onkeypress="textCounter(this,this.form.counter,300);"></TEXTAREA>
thistext.onkeypress = "";
by something like
thistext.setAttribute("onkeypress", "");
the reason being pitfall #2 "Event Handlers". After having read what
is said there, note that Mark Pilgrim's article gives a clue as to how
to *add* event handlers from inside GM; however, in order to
*override* them, you may have to do something like the above.
[1] http://www.oreillynet.com/lpt/a/6257
2007/6/10, NinjaTaiken <Ninja...@gmail.com>:
Unless it is completely impossible (internal company intranet, password
protected page, etc) it is *always* a good idea to give a link to the
exact page in question. Without it, anyone helping you has to guess at
a lot of things they might otherwise know.
That said, guess what? I have to guess at some details below, but the
simplest way to this would probably be using the location hack [1] to
override the textCounter function, make it always return true, false,
whatever the "string is ok" value is.
Basically, something simple like "textCounter=function(){return true}".