By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

ie srcElement not working just right

P: 3
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

Expand|Select|Wrap|Line Numbers
  1. AutoSuggestControl.prototype.DropDown = function () {
  2.  
  3.     var oThis = this;
  4.  
  5.     this.layer.onmousedown = 
  6.     this.layer.onmouseup = 
  7.     this.layer.onmouseover = function (oEvent) {
  8.         oEvent = oEvent || window.event;
  9.         oTarget = oEvent.target || oEvent.srcElement;
  10.  
  11.         if (oEvent.type == "mousedown") {
  12.             var txt = oTarget.value;
  13.             if (txt.indexOf("&")>0){
  14.               txt = txt.substring(0,txt.indexOf("&"));
  15.             }
  16.             oThis.textbox.value = txt;
  17.  
  18.         } else if (oEvent.type == "mouseover") {
  19.             oThis.highlightSuggestion(oTarget);
  20.         } else {
  21.             oThis.textbox.focus();
  22.         }
  23.     };
  24. };
Jan 16 '08 #1
Share this Question
Share on Google+
4 Replies


100+
P: 210
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.
I don't think I.E. supports all those events for selects - I suggest you try a rudimentary test for them.
Jan 17 '08 #2

P: 3
well if it did not support it wouldnt the javascript crash. and why would it work after 3 clicks? I think it works I am just not sure it knows what the event is. What do you suggest I do? what kind of test should I do and is there an effecient debugger that I can see errors in the code. I am really having a problem with that

T
Jan 17 '08 #3

P: 3
bump. anyone else have any suggestions. I really have to figure out what is going wrong here

T
Jan 17 '08 #4

acoder
Expert Mod 15k+
P: 16,027
Can you give the rest of the code or a test page link?
Jan 18 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.