473,804 Members | 3,462 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DDL keep repeating.. when selected

28 New Member
My code is similar to the one below.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script src="selectuser.js"></script>
  4. </head>
  5. <body><form> 
  6. Select a User:
  7. <select name="users" onchange="showUser(this.value)">
  8. <option value="1">Peter Griffin</option>
  9. <option value="2">Lois Griffin</option>
  10. <option value="3">Glenn Quagmire</option>
  11. <option value="4">Joseph Swanson</option>
  12. </select>
  13. </form><p>
  14. <div id="txtHint"><b>User info will be listed here.</b></div>
  15. </p></body>
  16. </html>
  17.  
  18.  
Each time i select something output the result and also show a new DDL and option.. So i having several DDL apparing one at a time when i select an option in the DDL.
Please help...
Mar 26 '08 #1
4 1251
acoder
16,027 Recognized Expert Moderator MVP
Can you show the JavaScript code?
Mar 26 '08 #2
princelindie
28 New Member
Expand|Select|Wrap|Line Numbers
  1. var xmlHttpfunction showUser(str)
  2. xmlHttp=GetXmlHttpObject()
  3. if (xmlHttp==null)
  4.  {
  5.  alert ("Browser does not support HTTP Request")
  6.  return
  7.  }
  8. var url="getuser.php"
  9. url=url+"?q="+str
  10. url=url+"&sid="+Math.random()
  11. xmlHttp.onreadystatechange=stateChanged 
  12. xmlHttp.open("GET",url,true)
  13. xmlHttp.send(null)
  14. }function stateChanged() 
  15. if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  16.  { 
  17.  document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
  18.  } 
  19. }function GetXmlHttpObject()
  20. {
  21. var xmlHttp=null;
  22. try
  23.  {
  24.  // Firefox, Opera 8.0+, Safari
  25.  xmlHttp=new XMLHttpRequest();
  26.  }
  27. catch (e)
  28.  {
  29.  //Internet Explorer
  30.  try
  31.   {
  32.   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  33.   }
  34.  catch (e)
  35.   {
  36.   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  37.   }
  38.  }
  39. return xmlHttp;
  40. }
  41.  
the code is base on an example online
Mar 26 '08 #3
princelindie
28 New Member
Not too worry.. Thanks anyway
Mar 26 '08 #4
acoder
16,027 Recognized Expert Moderator MVP
I guess the error was on the first line where you forgot the newline/semi-colon.

Anyway, glad you got it working.
Mar 27 '08 #5

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

Similar topics

119
4643
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see, http://www.alistapart.com/articles/betterliving/ I read on http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnnetdep/html/netfxcompat.asp It said they changed stuff like this
2
13315
by: Patrick | last post by:
Hello, I have a drop down list that when a value is selected the page refreshes itself but the selected value changes back to the default value. I would like to keep the selected value after the page is refreshed. any ideas? Thanks in advance. Patrick
1
2768
by: smash2004 | last post by:
I want to keep selected values in select list when i click on another option...with a click on a mouse... if i have 3 options in select list and i click first option..it gets selected..if i then click on third option ..it gets selected but i want also the first option to stay selected when i click on option that is already selected, then it should be deselected
4
2695
by: BBFrost | last post by:
We have a data entry application written within Framework 1.0 that contains 20+ custom user controls. The controls overlay each other so that only one custom control is visible at a time. What is the best way to keep the cursor from jumping to another non-visible control when the user tabs past the (currently designated) last control on the form. I've had some luck using the Leave event but the last visible control can change...
0
1096
by: Milkstr | last post by:
I have a database set where users predict the scores of football matches, i want to be able to display each users selection using just 2 pages, first page to select the username the second to display the info. The first page i've set so it just lists the different users that are in the database, using a repeating region. when someone clicks on the users name i want it to load another page using their username as a filter on the secton page. ...
2
4924
by: pmarisole | last post by:
I am trying to write a report that displays a hierarchy such as: Director, Manager, Employee I want to suppress the repeating Director, Manager for the employees. This is my code: sSQL = "SELECT FY99Info.MDName, FY99Info.MgrName, FY99Info.firstname, FY99Info.lastname, FY99Info.grade FROM FY99Info WHERE left(FY99Info.orgcode,5) = '" & left(session("MOrg"),5) & "' and FY99Info.mgmtlevel < 4
2
1554
by: mj.redfox.mj | last post by:
Does anyone know how I can do the following sort of thing (written in classic ASP), but in ASP.NET? This is a very, very basic repeating form element which uses a counter 'cntItems' to hold the current selected number of repeats: <% for intCounter = 1 to cntItems %> <input type="text" name="txtInput<% =intCounter %>">
2
1188
by: princelindie | last post by:
My code is similar to the one below. <html> <head> <script src="selectuser.js"></script> </head> <body><form> Select a User: <select name="users" onchange="showUser(this.value)"> <option value="1">Peter Griffin</option>
5
2331
by: squrel | last post by:
Hello everyone.. i have a small problem here... i have a combobox in my project call cmbresult which has been filled up in the properties by using list properties... i have 4 option there... whn i add a new record its fine and by clicking the drop down the 4 option is showing and i can select and add easily bt when i want to view any selected record whtever has been set for the cmbresult its repeating 2 times... i have tried to use the set...
0
9711
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9591
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10343
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10331
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10087
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4306
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 we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.