to download files in the system. You can use the following methods to achieve this:"/> to download files in the system. You can use the following methods to achieve this:">

Home >Web Front-end >JS Tutorial >How to implement document download with js code

How to implement document download with js code

小云云
小云云Original
2018-02-24 14:28:591208browse

During the project development process, sometimes it is not possible to directly use 8aa2918506a11e8a886e85949f1eb079 to download files in the system. You can use the following methods to achieve it:

<a href="#" id="help"> 帮助 </a>
<script type="text/javascript">
        $("#help").on("click",function(){
                var flag=window.confirm("确定下载说明文档吗?");    //弹框选择是否要下载文档
                if(flag){                                                                     //如果点击“确定”按钮
                        var url=contPath+&#39;/download/使用文档.doc&#39;;     //系统中文件的位置    //contPath是系统路径
                        window.location.href=url;
                }
        });
</script>

Related recommendations:

Easy-to-read document downloader PHP How to write easy-to-read code

How to download online help documents to the local. _html/css_WEB-ITnose

MySql stored procedure learning summary Attached pdf document download

The above is the detailed content of How to implement document download with js code. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn