function listToXml(){ var vList = document.getElementById('phonetic'); var vLen = vList.childNodes.length; var vXml = "<ul>"; for(var i = 0; i < vLen - 1; i++){ if(vList.childNodes[i].innerHTML){ vXml = vXml + '<li>' + vList.childNodes[i].innerHTML + '</li>'; } } vXml = vXml + '</ul>'; document.myform.listfield.value = vXml; } ... <ul id="phonetic" class="sortable boxy" style="margin-left: 1em;"> <li>alpha</li> <li>bravo</li> <li>charlie</li> <li>delta</li> <li>echo</li> <li>foxtrot</li> </ul> <form name="myform"> <input type="text" name="listfield" value="" size="60"> <input type="button" value="submit2" name="submit2" onClick="listToXml()"> </form>
You need to create an account or log in to post comments to this site.