javascript - read file using ActiveX separate by ; and put in select - option -
my goal: need read txt file using fso - activex separate text ; , put each separated word in select - option. far got aint working
<script> function readall() { var fso = new acitvexobject("scripting.filesystemobject"); var txtfile = fso.opentextfile("kategorije.txt", 1, false, 0); var ftext = txtfile.readall(); txtfile.close(); } var array = ftext.split(";"); var sel = document.getelementbyid("dropdown2"); (var = 0; < dropdown2.length; i++) { var opt = document.createelement("option"); opt.innerhtml = ftext[i]; opt.value = ftext[i]; sel.appendchild[opt]; } </script>
function readall() { var fso = new activexobject("scripting.filesystemobject"); var txtfile = fso.opentextfile("kategorije.txt", 1, false, 0); var ftext = txtfile.readall(); txtfile.close(); fso = null var array = ftext.split("\r\n"); var sel = document.getelementbyid("dropdown2"); (var = 0; < array.length; i++) { var opt = document.createelement("option"); opt.innerhtml = array[i]; opt.value = array[i]; sel.appendchild(opt); } } my code works , this
Comments
Post a Comment