简体   繁体   中英

javascript browse file and show content in iframe

Can any one help me to get the text to iframe using input method, rather than using SRC. i am using this to read text and use it in IE8 as alternative to fileReader method so that i can use the data in the text file for my requirement the code lines are.

<input type="file" name="fileread" />
<iframe id='iframe1' name='iframe1' src='fileread'> </iframe>

Reading files in javascript is not as easy as it sounds like. I suggest that first you check https://developer.mozilla.org/en-US/docs/Web/API/FileReader , there's a documentation. I found an great article from the net related to your question: http://www.htmlgoodies.com/beyond/javascript/read-text-files-using-the-javascript-filereader.html#fbid=9oig0UB93RL .

Hope you will find something.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM