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

Home Posts Topics Members FAQ

Ajax - createElement Duplicating Anchors

jenkinsloveschicken
56 New Member
Good afternoon. I am new to Ajax, and seem to have an issue in my use of createElement. Here is the code:

Expand|Select|Wrap|Line Numbers
  1.   xmlHttp.onreadystatechange=function()
  2.     {
  3.     if(xmlHttp.readyState==1)
  4.       {
  5.       var processing = document.createElement('img');
  6.       processing.setAttribute('src', 'img/loading_main.gif');
  7.       document.getElementById("empReport").appendChild(processing);
  8.       }
  9.     if(xmlHttp.readyState==4)
  10.       {
  11.       document.getElementById("empReport").innerHTML=xmlHttp.responseText;
  12.       }
  13.     }
  14.  
This is integrated with an existing classic ASP reporting application. It works to display the processing image, but duplicates the <img> anchor and I have tried and failed to determine why.

I am hoping someone can give me some insight on what I am doing wrong here.

Best Regards,
Jenkins
Oct 29 '08 #1
3 1547
acoder
16,027 Recognized Expert Moderator MVP
It's duplicating it because you're creating a new image element each time. If all you want to do is display it, get the element by its ID and then set the display property:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("imgID").style.display = 'block';
Oct 30 '08 #2
jenkinsloveschicken
56 New Member
Thank you for your assistance. Worked like a charm!
Oct 30 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
You're welcome. Glad it did!
Oct 30 '08 #4

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

Similar topics

13
by: adam | last post by:
Hey All, I'm relatively new to all this and any help would be appreciated. What I'm aiming to do is create a few requests, to 1. Search for a Student against XML created from the database 2. If...
7
exoskeleton
by: exoskeleton | last post by:
hi guys..hope you can help me...my boss want me to edit our website and apply the tooltip thing, i mean the moving tooltip that follows the mouse.. please help...thank you... :(
6
by: santhoskumara | last post by:
How to request to servlet from Ajax and also I got the DOM object in the servlet through Business Logic. Now how will i pass the DOM object from serlvet to Clientside. Where in the client Side i am...
21
by: Leena P | last post by:
i want to basically take some information for the product and let the user enter the the material required to make this product 1.first page test.php which takes product code and displays...
3
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need ...
1
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need ...
13
by: adamjblakey | last post by:
Hi, I am using the following function to do a country/region ajax drop down list. // JavaScript Document var AdminResponse = ""; function parseResponse(){
2
by: mndprasad | last post by:
Hi friends, Am new to AJAX coding, In my program am going to have two texbox which going to implent AJAX from same table. One box is going to retrieve the value of other and vice...
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
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
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...
1
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
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
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: 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 ...

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.