<input type="button" id="test1" onclick="oDownload.startDownload('a.txt',onDownloadDone);" value="xxxxx">

解决方案 »

  1.   

    <IE:Download ID="oDownload" STYLE="behavior:url(#default#download)" />
    <input type="file" id="file1">
    <input type="button" id="test1" onclick="Down();" value="xxxxx">
    <script>
    function Down()
    {
    var filename=file1.value;
    filename=filename.replace(/\\/g,'\\\\');
    var s="oDownload.startDownload('"+filename+"',onDownloadDone)";
    //alert(s);
    eval(s);
    }
    function onDownloadDone(ss)
    {
    alert(ss);
    }
    </script>
      

  2.   

    多谢,不过不是我想要的那种效果啊
    能不能把text.txt换成变量来表示
    比如说:
    aa="text.txt"
    onclick时
    先把aa="text1.txt"
    再进行操作如果可以,是不是要先定义aa?