473,395 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
4 1845
Logician
210 100+
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
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
bump. anyone else have any suggestions. I really have to figure out what is going wrong here

T
Jan 17 '08 #4
acoder
16,027 Expert Mod 8TB
Can you give the rest of the code or a test page link?
Jan 18 '08 #5

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

Similar topics

3
by: Dan | last post by:
Hi, When i click down with the mouse, i want to be sure that the image "myimg" is clicked before doing something. With IE i use 'srcElement' and it works: <IMG ID="myimg" SRC="bugs.gif"...
5
by: Jeff Thies | last post by:
I have this IE specific bit of code for finding the originating node: var obj=window.event.srcElement; How do I do that cross browser (Opera, NS, Safari...)? Is there a standard DOM method? ...
4
by: Josselin | last post by:
I am loading a group of items (urls of images to load) group.items for each items I associate the filename and an <img> object on my page using : .... var pair = new ImagePair(group.items);...
9
by: stevewy | last post by:
I am trying to write a function that will test all the checkboxes in a particular group of a form (it's a questionnaire), see whether more than three of them are ticked, and display a message if...
4
by: stevewy | last post by:
If I am using srcElement (or "target" for non-IE models) to return various properties of an object I have clicked on, can I access for "label for" value in any way? I'm thinking, for example, of...
3
by: Jake G | last post by:
Ok. I have figured out my whole script except how to make it work in FF. It is a script that lets a user know how many characters they have left for a textbox. Here is the code, is anyone savy...
12
by: Nileshs | last post by:
I have a page on which i need to show a pop up to the user if he tries to exit the page . I have already written an onunload function which takes care of displaying the popup . But the popup should...
5
by: anEchteTrilingue | last post by:
Hi everybody. Thank you for reading my post. I am having trouble getting "this" to work in all versions of IE (it's fine in Firefox, opera, konqueror, etc). What I would like to do is add an...
5
by: GarryJones | last post by:
To show users how many characters they have left in a TEXTAREA input I have been using "taCount" from a website I googled. function taCount(visCnt) { var taObj=event.srcElement; if...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.