:: Forum >>
multiple events
Hi everybody, i need to set more than an event for the same textarea, but by declaring twice the setevent sentence i get some problems...please give me some help...thanks!
rodrigo talento
Thursday, April 10, 2008
Can you post the code for what you are trying to do? It sounds like you are overwriting the first event handler with the later one.
Anthony
Thursday, April 10, 2008
var obj = new AW.HTML.TEXTAREA;
obj.setSize(600, 100);
obj.setEvent("onclick", function(){
if(obj.getContent("html")=="insert your comment here"){
obj.setContent("html", "");
obj.refresh();
obj.element().focus();
}
}
obj.setEvent("onkeypress", function(){
if(event.keyCode == 13){
alert("Don´t use line break");
event.keyCode=0;
}
}
there it is, i think it´s as you say, hope you can help me.
thanks
rodrigo talento
Friday, April 11, 2008
This code looks fine, except that it is better to use 'this' instead of 'obj' inside an event handler - otherwise your code will break if there is another variable called 'obj'.
Alex (ActiveWidgets)
Friday, April 11, 2008
Thanks, i'll use it that way!..i found the problem in my code, it was a parenthesis problem, i wasn't closing the parenthesis of the setevent sentences, thanks again...
rodrigo talento
Friday, April 11, 2008
Rodrigo, you might also want to change this code -
obj.setEvent("onkeypress", function(){
if(event.keyCode == 13){
to
obj.setEvent("onkeypress", function(event){
if(event.keyCode == 13){
I gather that you are using IE. The above change will allow it to work with other browsers.
Anthony
Saturday, April 12, 2008
Wow!, didn't know that, thanks a lot!
rodrigo talento
Monday, April 14, 2008
This topic is archived.
Back to support forum
Forum search