Home > Web Front-end > JS Tutorial > body text

javascript select folder dialog box (web)_javascript skills

WBOY
Release: 2016-05-16 18:50:22
Original
1325 people have browsed it

There is no way. Practice has proved that the best solution is to write an OCX control yourself. In this way, you only need to register the OCX control. At the same time, the OCX control is very scalable, which means that the functions of programs such as vcdelphi can be introduced into the web. , its functions can be imagined!
I won’t explain the OCX development process here. I will share the OCX control I wrote in the hope that it can help some friends.
This OCX control provides a getFiles() method. As long as you get the control object and then call the getFiles() method, you can get all the files in the corresponding path, as shown below:
OCX控件
This control You can select any folder under any drive letter. The bottom button in the picture is the input in the web. The file list is obtained through the js method in the web. The getFiles() method of OCX
returns the file name string. The style is as follows 1.jpg; 2.jpg; 3.jpg, use ";" link in the middle of each file name, and use the split method in js to separate them.
The page code is as follows:

Copy code The code is as follows:





Untitled Document




id="pathOcx"
classid="clsid: 13BF0862-063C-432F-A8DF-07C2823E8562"
width=420
height=300
align=center
hspace=0
vspace=0
>
< /OBJECT>






In this way, you can use this control to select any folder, and you can get all the contents in the folder through js. Due to limited space, we will not explain more functions of OCX here. The next article will add an upload function to OCX. , so that the entire folder can be uploaded and resumed uploading is supported.

Final note: You need to register the control when using OCX

Registration method: Run cmd, enter the OCX control at C:123.OCX, run RegSvr32 c:123.OCX in cmd, it will prompt that the registration is successful, and then you can use it on the web page!
Package download

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template