Working with “Out” Parameters in JavaScript

后端 未结 3 1839
星月不相逢
星月不相逢 2020-12-11 03:08

I am working with an ActiveX control in Internet Explorer 8 that is to display a save file dialog which let\'s the user choose a file name and file type (jpg, gif, etc). Th

3条回答
  •  时光取名叫无心
    2020-12-11 03:26

    Edit: It seems that it's not possible to have "out" parameters in JavaScript/JScript.

    Original: Perhaps the approach described in this article will work:

    var saveFileName={}, saveFileType={}; // Empty "output" objects.
    gxVideoPlayBack.SaveFileDialog("image", saveFileName, saveFileType);
    alert(saveFileName.value); // The "value" attribute is assigned ...
    alert(saveFileType.value); // ... by the "SaveFileDialog" method?
    

    I suppose the idea is that the WSH wrapper for this native call will attempt to assign the "value" property of the given output parameters, so you can either override the value setter or just give it an object with a built-in value setter.

提交回复
热议问题