你试试用这种方法打开
但首先得知道word执行文件的位置:
<script language="JavaScript">
<!-- Begin
function whatFile() {
window.location= 'file://' + document.form1.cmuds.value;
}
// End -->
</script>
<form name=form1>
<input type=file name="cmuds" style="font-size: 10pt; background-color: #ff9900; border: 1 solid" >
<input type=button onClick="whatFile()" value="打开文件" name="button" style="font-size: 9pt; background-color: #cccccc; border: 1 solid" >
</form>用window.location方法
但首先得知道word执行文件的位置:
<script language="JavaScript">
<!-- Begin
function whatFile() {
window.location= 'file://' + document.form1.cmuds.value;
}
// End -->
</script>
<form name=form1>
<input type=file name="cmuds" style="font-size: 10pt; background-color: #ff9900; border: 1 solid" >
<input type=button onClick="whatFile()" value="打开文件" name="button" style="font-size: 9pt; background-color: #cccccc; border: 1 solid" >
</form>用window.location方法
tomcat\conf\web.xml里:
<mime-mapping>
<extension>doc</extension>
<mime-type>application/msword</mime-type>
</mime-mapping>
如果不需要嵌入到浏览器里,直接加个连接指向该文件就可以了
function open_exe(shellp,str)
{
a=new ActiveXObject("wscript.shell");
a.run(shellp+" "+str);
}</script>
<button onclick="open_exe('winword.exe','c:\\long.doc')">打开word</button>