当前位置:编程学习 > C#/ASP.NET >>

word在线编辑实现修改服务器文件

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

<Script Language="JavaScript">
    function OpenWord() {
        var openDocObj;
        openDocObj = new ActiveXObject("SharePoint.OpenDocuments.1");
        openDocObj.ViewDocument("http://localhost/folder/123.doc");
    } 
</script> 

</head>
<body>
    <form id="form1" runat="server">
    <div>
   <input type="button" name="button" value="shouce" onclick="OpenWord()"> 

    </div>
    </form>
</body>
</html>

这是代码
运行后在对话框确定后打开文件发现打开的是空白的word文档
请问"http://localhost/folder/123.doc"这个地址对不对 或 在网站上是怎么处理  
一些VS2010用语不太懂的说 请教! --------------------编程问答-------------------- 呵呵,这个么很简单。你这段打开word的程序是在JS中的。而JS是在客户端执行的,也就是谁访问这个页面,就在谁的电脑上打开他的"localhost",而他的电脑上也要装了web server才起作用。

因此,要打开服务器上的这个123.doc,不能使用localhost,要使用你服务器的域名或IP地址。
例如:http://www.sina.com/123.doc
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,