473,396 Members | 2,129 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,396 software developers and data experts.

Two <div> ID Problem with AJAX

I have to two select boxes with values and two javascripts which call server-side scripts. The first select box will write to the first <div id='txtHint1'></div>, but when I intoduce a second <div id='txtHint2'></div>, the first select box writes to there instead of <div id='txtHint1'></div>.

First Select Box

Expand|Select|Wrap|Line Numbers
  1. onchange='javascript:showCertificates(this.value)
Second Select Box

Expand|Select|Wrap|Line Numbers
  1. onchange='javascript:showEndorsements(this.value)
First JS

Expand|Select|Wrap|Line Numbers
  1. function stateChanged() 
  2. {
  3. if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  4.  { 
  5.  document.getElementById("txtHint1").innerHTML=xmlHttp.responseText
  6.  } 
  7. }
  8.  
Second JS

Expand|Select|Wrap|Line Numbers
  1. function stateChanged() 
  2. {
  3. if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  4.  { 
  5.  document.getElementById("txtHint2").innerHTML=xmlHttp.responseText
  6.  } 
  7. }
Aug 21 '08 #1
1 1183
acoder
16,027 Expert Mod 8TB
The problem is you've used the same function name. Use a different function name, even something as simple as stateChanged2().

PS. please remember to use code tags when posting code. Thanks!
Aug 22 '08 #2

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

Similar topics

1
by: OM | last post by:
I've found out that I can use <div id = "variable"><div> to change text and pictures on mouseovers. All I have to do is change "variable" to be the HTML text I want. I can even change the text...
23
by: Mikko Ohtamaa | last post by:
From XML specification: The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. (This means that <foo></foo> is equal to...
44
by: Jim M | last post by:
I have had great success with using <iframe> with overflow-y set to auto. I can get a similar look with the <iframe> tag. BUT... In all cases I need to have fixed heights. Is there a way to...
14
by: Charlie T | last post by:
Hello, is there any way to get this to work? myID.innerHTML = "Hello" <DIV id="myID"></DIV> <DIV id="myID"></DIV>
4
by: He Shiming | last post by:
Hi, I'm wondering how can I use <DIV> to mimic a <TABLE>. In a bare <TABLE> without a width attribute, the width of the table get dynamically expanded according to the content. However, <DIV>...
8
by: localhost | last post by:
I would like to wrap all of the HTML inside of my <body> tag inside a <div> with in my code-behind. I do not want to touch the .aspx page template at all. I know how to make the body tag...
0
by: tomasio | last post by:
Dear NG-Readers, First I want to apologize for crossposting this, but I got no idea where this topic really belongs to. I have built a html-page with some CSS. Anything behaves as expected, just...
13
Frinavale
by: Frinavale | last post by:
Hi there! I've created a "message" box that consists of a <div> with a bunch of information in it and some buttons (which could be "ok", "yes", "no", "cancel"...). It's dynamically created with...
8
prino
by: prino | last post by:
Hi all, I've written code (in REXX) that takes files in legacy languages (PL/I, COBOL, z/OS assembler, etc) and converts them into HTML in a format similar to what's displayed in the z/OS ISPF...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.