js下载文件功能

方法一:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head runat="server">
<title>文件下载</title>
</head>
<!DOCTYPE html>  
<
<body>  
<script>
function downLoad(){
    var elemIF = document.createElement("iframe");   
    elemIF.src = http://down.360safe.com/360safe_cq.exe;  
    elemIF.style.display = "none";   
    document.body.appendChild(elemIF);

}
</script>

<a href="#" onClick="downLoad()">点击下载</a>
</body>  
</html>

方法二:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head runat="server">
<title>文件下载</title>
</head>
<!DOCTYPE html>  
<
<body>  
<script>
function downLoad(){
    window.location.href=http://down.360safe.com/360safe_cq.exe;
}
</script>

<a href="#" onClick="downLoad()">点击下载</a>
</body>  
</html>



猜你喜欢

转载自blog.csdn.net/u013096666/article/details/51484393