比如服务器的访问url为:http://localhost:6666/sdn,服务器根目录下有一个test.doc的word文件。
如何在网页上点击超链接的时候,打开该word文件?
实现代码:
<html>
<head>
<script>
function openDoc()
{
var openDocObj = new ActiveXObject("SharePoint.OpenDocuments.2"); // 为了兼容Office XP,可以创建“SharePoint.OpenDocuments.1”
openDocObj.ViewDocument("http://localhost:6666/sdn/test.doc");
}
</script>
</head>
<body>
<a href='#' onclick = "openDoc()">打开服务器根目录下的word文件</a>
</body>
</html>