Skip to content

Instantly share code, notes, and snippets.

@z8888q
Created February 27, 2012 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save z8888q/1920690 to your computer and use it in GitHub Desktop.
Save z8888q/1920690 to your computer and use it in GitHub Desktop.
打开你选择的文本文件
<script>
function showi(ptu)
{try{
var ado=new ActiveXObject("ADODB.Stream")
ado.Type=2
ado.Mode = 3
ado.Charset = "GB2312"
ado.Open()
ado.LoadFromFile(ptu)
var doc=ado.ReadText()
ado.Close()
dv.document.body.innerText=doc
}catch(e){ssay=""
for(i in e){ssay+=i+":"+eval('e.'+i)+"\n"}
alert(ssay)}}
</script>
<input type="file" name="fle" onchange=showi(fle.value)>
<iframe width="100%" height="80%" name="dv" id="dv"></iframe>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment