开发者

write bytestream to a activex object in javascript

I am trying to create a file on the local machine which capture开发者_如何学JAVAs the var file in javascript.

<script>

function button_click()

{

var file = GetFile('Getdoc'.aspx');

WriteToFile();

}

function WriteToFile() {

    var fso, s;

    fso = new ActiveXObject("Scripting.FileSystemObject");

    s = fso.CreateTextFile("C:\\Test\\Logfile.txt");

    s.Write(file1);

    s.Close();

}

</script>

Here we get a httpresponse stream which contains data in bytes into var file.

If I could find some help on this would be appreciated. Thank you.


If I understand you correctly, you are encountering a problem when you are trying to write a file using ActiveXObject on IE? There is two things wrong with your script.

  1. var file = GetFile('Getdoc'.aspx'); should be var file = GetFile('Getdoc.aspx');

  2. You do not have file1 defined, so it is writing nothing to the file.

You need to keep in mind that most versions of IE have this functionality disabled due to the huge security risk that this poses.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜