肠炎宁片有什么副作用:网页里单击按钮控件调用WORD程序文件

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/09 04:00:59
我要在网页里加一个按钮控件,单击按钮控件调用WORD、或EXCEL、ppt文件程序文件
现在调用 是可以了,请问怎样让他打开指定的word excel ppt 文件 。比如 调用桌面的c:\windows\desktop\123.doc WORD 文件呢
谢谢

<!--以下网页代码可以调用Office程序(但在提示是否允许运行ActiveX控件时要选择是),并打开选择的文档。-->
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页调用Office程序</title>
</head>
<script language=vbscript>
<!--
dim myApp
sub RunOffice(app)
select case app
case "Word"
set myApp=createobject("word.Application")
myapp.visible=true
if FileName.value <>"" then myapp.Documents.Open FileName.value
case "Excel"
set myApp=createobject("excel.Application")
myapp.visible=true
if FileName.value <>"" then myapp.Workbooks.Open FileName.value
case "PPT"
set myApp=createobject("PowerPoint.Application")
myapp.visible=true
if FileName.value <>"" then myapp.Presentations.Open FileName.value
end select
end sub
-->
</script>

<body>

<p><input type="file" id="FileName" size="20"></p>
<p><input type="button" value="用Word打开文档" name="B1" onclick="RunOffice('Word')"></p>
<p>
<input type="button" value="用Excel打开文档" name="B2" onclick="RunOffice('Excel')"></p>
<p><input type="button" value="用PPT打开文档" name="B3" onclick="RunOffice('PPT')"></p>

</body>

</html>