1
2
3
4
5
6
RDP7
8 body {9 padding: 0;10 margin: 0;11 }12
13
14
15
16 //if ("条件") {17 //if (window.opener.SetRDPID) {//调用打开此页的父页面中的方法18 //window.opener.SetRDPID("123");19 //};20 //连接远程桌面的方法
21 function RdpConnect() {22 varuserName, Pwd, server, domain, port;23 userName = "administrator"; //用户名
24 server = "192.168.1.117"; //IP
25 port = 3389; //端口
26 domain = "myDomain"; //域
27 if (!MsRdpClient.Connected) {28 try{29 document.getElementById("connectArea").style.display = "block"; //显示远程桌面div
30 MsRdpClient.Server = server; //设置远程桌面IP地址
31 try{32 MsRdpClient.AdvancedSettings2.RedirectDrives = false;33 MsRdpClient.AdvancedSettings2.RedirectPrinters = false;34 MsRdpClient.AdvancedSettings2.RedirectPrinters = false;35 MsRdpClient.AdvancedSettings2.RedirectClipboard = true;36 MsRdpClient.AdvancedSettings2.RedirectSmartCards = false;37 } catch(ex) {38 };39
40
41 MsRdpClient.Domain = domain;//域
42 MsRdpClient.UserName =userName;43 //MsRdpClient.AdvancedSettings2.ClearTextpassword = Pwd;//密码
44 MsRdpClient.AdvancedSettings2.RDPPort = port; //端口
45 if (document.getElementById("ColorDepth").value == 1) {46 ColorDepth16();47 } else{48 ColorDepthDefault();49 };50 MsRdpClient.FullScreen = 1; //是否全屏 0否 1是
51 if (document.getElementById("Screen").value == 1) {52 Screen1();53 } else{54 ScreenDefault();55 };56 try{57 //如果不支持,继续下面操作
58 MsRdpClient.AdvancedSettings7.EnableCredSspSupport = true;59 MsRdpClient.AdvancedSettings5.AuthenticationLevel = 2;60 } catch(ex) {61 } finally{62 MsRdpClient.Connect(); //连接远程桌面
63 }64 } catch(ex) {65 alert("发生错误:" + ex.message + "请尝试刷新页面重新连接。");66 };67 } else{68 alert("已连接!");69 };70 };71 //var logoff = false;//存储是否正常注销72 //全屏
73 function FullScreen() {74 if(MsRdpClient.Connected) {75 MsRdpClient.FullScreen = 1;76 };77 };78 //1024*768
79 function ScreenDefault() {80 MsRdpClient.Width = 1024; //设置远程桌面 显示区域的宽和高
81 MsRdpClient.Height = 768;82 MsRdpClient.DesktopWidth = 1024; //设置 远程桌面的宽和高
83 MsRdpClient.DesktopHeight = 768;84 };85 //800*600
86 function Screen1() {87 MsRdpClient.Width = 800; //设置远程桌面 显示区域的宽和高
88 MsRdpClient.Height = 600;89 MsRdpClient.DesktopWidth = 800; //设置 远程桌面的宽和高
90 MsRdpClient.DesktopHeight = 600;91 };92 //色彩度,默认32位
93 function ColorDepthDefault() {94 MsRdpClient.ColorDepth = 32;95 };96 //色彩度16位
97 function ColorDepth16() {98 MsRdpClient.ColorDepth = 16;99 };100 function reSet() {101 document.getElementById("Screen").selectedIndex = 1;102 document.getElementById("ColorDepth").selectedIndex = 1;103 };104
105 //关闭当前页面
106 function closeWindow() {107 window.opener = null;108 window.open("", "_self");109 window.close();110 };111
112
113
114 分辨率:
115 800*600
116 1024*768
117
118 色彩度:
119 16位
120 32位
121
122
123
124
125
126
127
128
129
130
131
132 classid="CLSID:7584c670-2274-4efb-b00b-d6aaba6d3850"
133 codebase="msrdp.cab#version=5,2,3790,0" width="1024px" height="768px">
134
135
136
137
138 function MsRdpClient::OnDisconnected(disconnectCode) {139 document.getElementById("connectArea").style.display = "none";140 //正常注销,代码为2141 //if (disconnectCode != 2) {142 //if (logoff == false) {143 //alert("计算机处于断开状态,请根据提示完成后续步骤:\r\n(1)如果您操作已完成,请刷新页面重新连接并注销;\r\n(2)如果仍需操作,请刷新页面后继续,完毕后请注销。\r\n谢谢您的配合!");144 //} else {145 //alert("计算机已注销,如需使用,请刷新此页面。");146 //}147 //} else {148 //logoff = true;//记录注销状态149 // //关闭当前页面150 //};
151 closeWindow();152 }153
154
155
156
157