锚标记在HTA中不起作用

时间:2015-09-16 09:52:18

标签: javascript html hta

按钮点击后我创建了一个文件。并通过锚标签下载。这在浏览器中工作正常。但不适用于HTA应用程序。以下是我的代码。

<html>
<head>
    <title>
        FileCreation
    </title>
    <script>
    function create_file()
    {
   var data=new Blob(["File Contents....."], {type: 'text/plain'});
   var link=document.getElementById("downloadlink")
   link.href=window.URL.createObjectURL(data);
   link.style.display = 'block';
}
    </script>
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
    <hta:application
    border="thin"
    innerborder="no"
    version="1.0"
    windowState="maximize"
    navigable="yes"
    maximizebutton="yes"
    showintaskbar="yes"
    singleinstance="yes"
    scroll="no" />
</head>
<body>
<button type="button" href="" id="create_file"  style="width:200px;height:40px;font-size:140%" onclick="create_file()">Generate Job File</button>
<a download="file.txt" id="downloadlink" style="display: none">Download</a>
</body>

0 个答案:

没有答案