Original website: http://blog.csdn.net/cofesun/article/details/7904887
JavaScript has a special object ActiveXObject that allows access to the local file system and applications of Windows
<Script> functionopenfileiis (filename) {Try{ varobj=NewActiveXObject ("Wscript.Shell"); if(obj) {obj. Run ("\""+filename+"\"", 1, false ); Obj=NULL; } }Catch(e) {alert ("please determine if the drive letter or file exists"); } }
</Script>
if the new ActiveXObject ("Wscript.Shell") creation failure should be handled like this
JavaScript uses new ActiveXObject ("Wscript.Shell") to create an object that appears: The Automation server cannot create an object error because of
One, the component is not registered, you can use the following methods:
Start-"Run-" regsvr32 c:\WINDOWS\system32\shell32.dll
Start-"Run-" regsvr32 c:\WINDOWS\system32\WSHom.Ocx
Start-"Run-" regsvr32 c:\WINDOWS\system32\scrrun.dll
If the hint is missing that DLL or OCX, then go to download it online or copy it to another computer.
Second, the browser settings (this method on IE6), you can use the following methods:
Tools-"Internet Options-" security-"Trusted sites-" site-"Remove the check boxes below that Require security verification, add your URLs, confirm, and then select the check boxes that require verification."
With the above settings, this component has been created, but is limited and is not recommended for use by websites.
JS implementation open a local file or folder