I am a begginer to JavaScript (as you can probably see) currently working on a web page to display equipment info when "MouseOver"-ing a picture of the equipment. The info is stored in an XML file that has been exported from an Access 2002 database.
Upon MouseOver, my script calls the function getText(assetID) where "assetID" is a four-digit number depending on the MouseOver area. (example: "3631")
I need something that searches the XML file for
Expand|Select|Wrap|Line Numbers
- <Asset_x0020_Number>3631</Asset_x0020_Number>
This is what I have so far, but I'm missing the crucial piece.
Expand|Select|Wrap|Line Numbers
- function getText(assetID)
- {
- var text = assetID + '\n'; //the first thing I want is the assetID
- var sibling;
- var numberOfSiblings;
- for(var counter=0; counter<numberOfSiblings; counter++)
- {
- //code here to make "sibling" be the next sibling, and the next one after that one the next iteration
- text=text + sibling + '\n';
- }
- }
There might be a way to do it all at once, but I have no clue as to how.
here is the piece of equipment with assetID 3631
Expand|Select|Wrap|Line Numbers
- <CONVEYOR_x0020__x0028_BELT_x0029_>
- <Asset_x0020_Number>3631</Asset_x0020_Number>
- <Unit_x0020_Number>30058C1</Unit_x0020_Number>
- <Serial_x0020_Number>300235BEC1</Serial_x0020_Number>
- <Remark>Crusher Discharge Belt</Remark>
- <NOTES><![CDATA[[in Drawing 42-300 reducer=TDT515] [D-42-300 mentions "24" long type G.M. screw Take-Up under TAILSHAFT]]]></NOTES>
- <Motor>81925</Motor>
- <V-belts>BX83</V-belts>
- <_x0023__x0020_of_x0020_V-belts>3</_x0023__x0020_of_x0020_V-belts>
- <Reducer>1111115</Reducer>
- <Drive_x0020_Sheave_x0020__x0028__x0022__x0029_>5.0 Pitch Diameter</Drive_x0020_Sheave_x0020__x0028__x0022__x0029_>
- <Driven_x0020_Sheave_x0020__x0028__x0022__x0029_>18.4 Pitch Diameter</Driven_x0020_Sheave_x0020__x0028__x0022__x0029_>
- <Drive_x0020_Sheave_x0020_Bushing_x0020__x0028__x0022__x0029_>1-1/8 (#1615)</Drive_x0020_Sheave_x0020_Bushing_x0020__x0028__x0022__x0029_>
- <Driven_x0020_Sheave_x0020_Bushing_x0020__x0028__x0022__x0029_>1-1/4 (#2517)</Driven_x0020_Sheave_x0020_Bushing_x0020__x0028__x0022__x0029_>
- <Belt_x0020_Length_x0020__x0028_feet_x0029_>112</Belt_x0020_Length_x0020__x0028_feet_x0029_>
- <Belt_x0020_Type>1000108</Belt_x0020_Type>
- <Head_x0020_Shaft_x0020_Size>2-15/16</Head_x0020_Shaft_x0020_Size>
- <Tail_x0020_Shaft_x0020_Size>2-7/16</Tail_x0020_Shaft_x0020_Size>
- <Capacity_x0020__x0028_MTPH_x0029_>240</Capacity_x0020__x0028_MTPH_x0029_>
- </CONVEYOR_x0020__x0028_BELT_x0029_>
PS: if there's an Access wizard in the crowd, I was wondering if there was a way to make Access automatically update the XML files or to link the Javascript directly into the database (which would be the ideal thing)
PPS: I hope this is in the right forum!