ie srcElement not working just right

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • taygolf
    New Member
    • Jan 2008
    • 3

    ie srcElement not working just right

    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]
    Last edited by acoder; Jan 16 '08, 07:19 PM. Reason: Added code tags
  • Logician
    New Member
    • Feb 2007
    • 210

    #2
    Originally posted by taygolf
    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.

    Comment

    • taygolf
      New Member
      • Jan 2008
      • 3

      #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

      Comment

      • taygolf
        New Member
        • Jan 2008
        • 3

        #4
        bump. anyone else have any suggestions. I really have to figure out what is going wrong here

        T

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Can you give the rest of the code or a test page link?

          Comment

          Working...