473,473 Members | 1,513 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Javascript : Select Box not functioning properly

4 New Member
Hi,

I'm new to javascript & trying to achieve a feature for Select Box to incorporate the feature of a textbox also. Like my select box has two events attached, onchange=smeFunction(var1.value) & onkeyup=findValue(this).

Expand|Select|Wrap|Line Numbers
  1. function findValue(sel) {
  2.  
  3.     var temp = true;
  4.     var k = String.fromCharCode(event.keyCode);
  5.     fnd += k;
  6.     for (var i=0; i<sel.options.length; i++) {
  7.     if (fnd.toUpperCase() == sel.options[i].text.substring(0, fnd.length).toUpperCase())
  8.                 {
  9.        sel.options[i].selected = true;
  10.        temp = false;
  11.       break;
  12.     }
  13.     }
  14.     if(temp) {
  15.                        fnd = "";
  16.                        fnd += k;
  17.                 }
  18.         return true;
  19.     }
Now the problem is findValue() is returning correct value in the select box, but the screen changes are reflected wrongly based on onchange event. Like if i have ATR, CLA, etc as options & i type CLA, the select box shows CLA but the screen shows the changes wrt ATR, which belongs to the last character presssed 'A' in 'CLA'. Kindly tell whether the function itself is wrong or i can do something to improve it.

Please help, i am in great need,
Thanks in advance.....
Jun 12 '07 #1
2 1264
iam_clint
1,208 Recognized Expert Top Contributor
the events are on the text box or the select box?
Jun 12 '07 #2
wsharad
4 New Member
the events are on the text box or the select box?
Hi, the events are on the Select Box....
Jun 13 '07 #3

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

Similar topics

13
by: Kai Grossjohann | last post by:
It seems that Ctrl-N in Mozilla opens a new empty browser window. That's fine, I don't need to do anything about it. But Ctrl-N in IE appears to clone the current window. Is there a way to...
9
by: Prowler | last post by:
In our current application we have a page whose sole purpose for existence is to permit the user to select from a list (subsequent to our login page). We would like to have the list drop down...
1
by: I am Sam | last post by:
I have a select statement that isn’t functioning properly: private void Page_Load(object sender, System.EventArgs e) { myClubNow1=new...
3
by: LeroyTheGreat | last post by:
I have developed a web site application in visual studio 2005 using webparts.It works fine on one pc but when i get latest source on another and try running i get lots of javascript errors. ...
3
by: Zeez | last post by:
Hi all, I have a webpage that calls a webservice found on a remote computer. Below is the code of my webpage: ===================================== <html> <head> <script...
17
by: geniajanssen | last post by:
Hi there: I cannot get the code below to work properly. It works fine on the first loop but the next times around "$querySQL = 'SELECT * FROM host_index'" returns the wrong value. Can somebody...
4
by: JLupear | last post by:
My friend and I are trying to start a business and are writing a website of our own. We have been trying to create an online estimator and are having trouble with writing the javascript that is to...
6
by: mcfly1204 | last post by:
I have a page that contain input form, a contact us page. I also have a few javascript functions, one in particular sends the visitor back to the home page. My javascript is not functioning...
1
by: xtremebass | last post by:
Hello Bytes, i have a calender program which is created by using Javascript. when i execute that program using Internet Explorer,it works properly but when i tried in Mozilla firefox it didnt...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.