javascript获取客户端默认打印机

JS

 

    <script language="javascript">

        function startRequest() {

            var oShell = new ActiveXObject("WScript.Shell");

            var sRegVal = 'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows\\Device';

            var sDefault = oShell.RegRead(sRegVal);

            return sDefault;

        }



 

        function Start (){

            var cpname = startRequest();

            alert(cpname);

        }

    </script>

html input调用Start方法

 <input onclick="return Start();" type="button" value="获取客户端默认打印机"/>

 

你可能感兴趣的:(JavaScript)