hey guys,
I got a problem with srcElement and ie. I have a function called dropdown. What it is supposed to do is take the onmousedown event and get the select option from the drop down menu and place it in the text box. Also on mousehover it is supposed to highlight the option it is hovering over.
simple enough. I want it to work in ie and firefox. it works prefectly in firefox but ie is a different story. I have to click on the option I want select 3 times to get it to work in ie.
what could be the problem? I have posted my code below.
T
[CODE=javascript]AutoSuggestCont rol.prototype.D ropDown = function () {
var oThis = this;
this.layer.onmo usedown =
this.layer.onmo useup =
this.layer.onmo useover = function (oEvent) {
oEvent = oEvent || window.event;
oTarget = oEvent.target || oEvent.srcEleme nt;
if (oEvent.type == "mousedown" ) {
var txt = oTarget.value;
if (txt.indexOf("& ")>0){
txt = txt.substring(0 ,txt.indexOf("& "));
}
oThis.textbox.v alue = txt;
} else if (oEvent.type == "mouseover" ) {
oThis.highlight Suggestion(oTar get);
} else {
oThis.textbox.f ocus();
}
};
};[/CODE]
I got a problem with srcElement and ie. I have a function called dropdown. What it is supposed to do is take the onmousedown event and get the select option from the drop down menu and place it in the text box. Also on mousehover it is supposed to highlight the option it is hovering over.
simple enough. I want it to work in ie and firefox. it works prefectly in firefox but ie is a different story. I have to click on the option I want select 3 times to get it to work in ie.
what could be the problem? I have posted my code below.
T
[CODE=javascript]AutoSuggestCont rol.prototype.D ropDown = function () {
var oThis = this;
this.layer.onmo usedown =
this.layer.onmo useup =
this.layer.onmo useover = function (oEvent) {
oEvent = oEvent || window.event;
oTarget = oEvent.target || oEvent.srcEleme nt;
if (oEvent.type == "mousedown" ) {
var txt = oTarget.value;
if (txt.indexOf("& ")>0){
txt = txt.substring(0 ,txt.indexOf("& "));
}
oThis.textbox.v alue = txt;
} else if (oEvent.type == "mouseover" ) {
oThis.highlight Suggestion(oTar get);
} else {
oThis.textbox.f ocus();
}
};
};[/CODE]
Comment