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

Home Posts Topics Members FAQ

getelementbytag name help

3 New Member
I'm not sure if I have the syntax right or if I'm using the wrong code or what, but I just can't seem to get this to work. Please someone point me in the right direction.

Expand|Select|Wrap|Line Numbers
  1. function ajaxRequest(){
  2. var URL = "pictures.xml";
  3. var request = false;
  4. if (window.XMLHttpRequest) {
  5. request = new XMLHttpRequest();
  6. }
  7. else if (window.ActiveXObject) {
  8. try {
  9. request = new ActiveXObject("Msxml2.XMLHTTP");
  10. }
  11. catch (e){
  12. try{
  13. request = new ActiveXObject("Microsoft.XMLHTTP");
  14. }
  15. catch (e){}
  16. }
  17. }
  18. request.open("GET", URL, true);
  19. request.onreadystatechange = function() {
  20. if (request.readyState == 4) { 
  21. var xmlDoc = request.responseText;
  22. var xDocument = xmlDoc.getElementsByTagName("picture");
  23. var numXml = xDocument.length;
  24. var setNumbers = numXml / 4;
  25.     for (i=0;i<numXml;i++){
  26.  
  27. srcArray[i] = xmlDoc.getElementsByTagName("src")[i].firstChild.nodeValue;
  28.  
  29. altArray[i] = xmlDoc.getElementsByTagName("alt")[i].firstChild.nodeValue;
  30.  
  31. img = "<img src=\'"+srcArray[i]+"\' onClick=\'replaceMain("+i+")\'     onmouseover=\"this.style.cursor=\'pointer\'\" alt=\'"+altArray[i]+"\' width=144 height=108 >";
  32.  
  33. imageArray[i] = "<li>"+img+"</li>";
  34.                  } 
  35.                  }
  36. }
  37. request.send(null);
  38. }
  39.  
my xml set up is like this:

<gallery>
<picture>
<src>Source Here</src>
<alt>Alt text here</alt>
</picture>
</gallery>
Feb 29 '08 #1
1 1712
acoder
16,027 Recognized Expert Moderator MVP
Use responseXML instead of responseText.
Mar 1 '08 #2

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

Similar topics

21
6566
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help Workshop program: hcw.exe that's included with Visual Basic. This exact same file compiled perfectly with no notes, warnings or errors prior to reformatting my system. Prior to the reformatting, I copied the help.rtf file onto a CD and checked the box to...
6
4359
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing result in any way. Who can help me, I thank you very very much. list.cpp(main program) //-------------------------------------------------------------------------- - #pragma hdrstop #pragma argsused
10
54908
by: InvisibleMan | last post by:
Hi, Thanks for any help in advance... Okay, I have the JS listed below that calls for the display of the (DIV) tag... cookie function not included, as don't feel its necessary but you'll get the idea! function closeall() { var objs;
3
3370
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With numarray, help gives unhelpful responses:
7
5398
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available from clicking on many of the available topics (mostly methods but some properties are also unavailable). This same problem occurs with many, if not most, keywords. Is there any way I can activate these "missing" help topics? HELP!
1
2133
by: Zürcher See | last post by:
If I have a xmlNode that point to a xmlComment, the name of the node is "#comment", but if I try to get all the comment with the GetElementByTagName("#comment"), the xmlNodeCollection is empty. There is a way to get the xmlNodeCollection of the xmlComment?
5
3292
by: Steve | last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp My expectation is that a developer using my DLL would be able to access this help file during his development time using "F1" help within the VB IDE. Is this expectation achievable In trying to test my help file in the IDE, I have a solution with 2 projects: the DLL and a tester. VB does not look for my help file; instead, it looks for path to my source code...
8
3240
by: Mark | last post by:
I have loaded Visual Studio .net on my home computer and my laptop, but my home computer has an abbreviated help screen not 2% of the help on my laptop. All the settings look the same on both including search the internet for help, but the help is worthless. Any ideas?
5
7205
by: marcus6 | last post by:
Howto access xmlHttp.responseText as document.getElementByTagName ? If I access a .html page through the xmlHttp, how can I use the functions .getElementsByTagName and .getElementById on the data found in the xmlHttp.responseText? (the .responseXML returns null, and the responseText is simple text, of course containing valid html code)
1
4840
by: gsreenathreddy | last post by:
Hi! I would like to know the difference between getElementById and getElementByTagName.
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...
1
7631
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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();...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
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.