Load values of a file at an html form -


is there way load values of .txt file or .doc file , insert them @ html form possible values? example have rooms 1-10 written @ txt file, , form need scroll , check of rooms. thanks

in past did following: 1 iframe loads txt file, visibility: hidden;position: absolute style. onload event triggers javascript function can parse it. use reading function:

iframeobj = document.getelementbyid('put here iframe id') if (iframeobj != null) {     if (iframeobj.contentdocument)     {         txtfilecontent=iframeobj.contentdocument.getelementsbytagname("body")[0].innerhtml;     }     else if (iframeobj.contentwindow)     {         txtfilecontent=iframeobj.contentwindow.document.body.innerhtml;     }      // here can use txtfilecontent, string } 

usually trigger reload of txt file in end, if have fill form not recommended.

if want before loading page, however, should use server side code, such php , file_get_contents function. advantage of approach won't need expose txt file user, can stay hidden on server.


Comments