473,387 Members | 1,476 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,387 software developers and data experts.

DDL keep repeating.. when selected

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 1226
acoder
16,027 Expert Mod 8TB
Can you show the JavaScript code?
Mar 26 '08 #2
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
Not too worry.. Thanks anyway
Mar 26 '08 #4
acoder
16,027 Expert Mod 8TB
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
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,...
2
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...
1
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...
4
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...
0
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...
2
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 =...
2
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...
2
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...
5
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...

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.