I have one xml file from which the main root starts:
<design title="standard Cards 3.5 x 2" > <previews></previews> <previews1></previews1> <previews2></previews2> </design>
I want to read these xml files and get the header tags and assign them in the parameter value.
I also got these design tags with this w3school method. I want to get design → title and saved in my selection box:
Here is my code:
var selectHTML = ""; selectHTML += "<select name='something' id='media' onchange='select();'>"; for (i = 0; i < total.length; i = i + 1) { if (total[i] != '') { xmlDoc = loadXMLDoc($loc); var fruits = xmlDoc.documentElement.nodeName; if (fruits) { alert(fruits); var name = xmlDoc.getElementsByTagName("design") alert(name); } selectHTML += "<option value='" + total[i] + "'>" + name + "</option>"; } } selectHTML += "</select>";
Here xmlDoc=loadXMLDoc($loc); calls the xml file method. I refer to this from the w3school tutorial
I just warn name , resulting in undefined. How to solve this?
I want to put the name value in the value of the block selection option. How to read xml files using javascript and put in parameter value?
source share