zoukankan      html  css  js  c++  java
  • <a>标签实现文件下载

    html部分

    页面1:触发函数

    <li onclick="downLoadFiles()">
    	   <i class="i-download"></i>
    	   <p>下载</p>
    </li>
    

      

    js部分

    function downLoadFiles() {
    window.open(c.WEB_APP_NAME+"/pages/public/main/FilesList.html");
    },

    页面2:弹出下载页面,只要将文件放在本项目的相对路径下即可

    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style>
    .div {
    position:absolute;
    top:50%;
    left:50%;
    margin:-50px 0 0 -200px;
    400px;
    height:300px;
    }
    </style>
    </head>
    <body>
    <div class="div" style="text-align:center;" >
    <a style="font-size:18px;" href="./files/file1.doc" class="STYLE1" >文件1下载</a>
    <br>
    <a style="font-size:18px;" href="./files/files2.doc" class="STYLE1">文件2下载</a>
    </div>
    
    </body>
    
    <script type="text/javascript">
    <script>
    

      

  • 相关阅读:
    软件测试工程师的素质
    软件测试阶段的划分
    如何去涉及测试用例
    如何判断测试结束
    Linux常用命令大全
    测试用例设计方法
    Web测试方法
    loadrunner
    谈谈重复性测试
    软件测试思维导图
  • 原文地址:https://www.cnblogs.com/5588kjx/p/9700101.html
Copyright © 2011-2022 走看看