网页代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" href="http://lyclub.f3322.net:82/web_images/32X32.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>友情链接桌面</title>
<style type="text/css">
body{padding:0px; margin:0px;}
#deskbgimg { position:fixed; top:0px; left:0px; right:0px; bottom:0px; }
#deskbgimg img{ width:100%; height:100%; }
#deskbgtm { position:fixed; top:0px; left:0px; right:0px; bottom:0px; filter:alpha(Opacity=40);-moz-opacity:0.4;opacity: 0.4;background:gray;}
#desklogo{height:120px;width:80px;position:absolute;z-index:2;cursor:default;}
#desktbar {position:fixed; left:0px; right:0px; bottom:0px; height:40px;filter:alpha(Opacity=40);-moz-opacity:0.8;opacity: 0.8;background:black; z-index:3;}
.dlgico{ margin:10px; width:60px; height:60px; cursor:default;}
.dlgtit {margin:2px;font-size:14px;font-family:黑体;color:blue;text-align:center;line-height:20px;cursor:default;}
#startmenu{border:1px solid red;background:white;filter:alpha(Opacity=40);-moz-opacity:0.8;opacity: 0.8;z-index:5;position:fixed;width:150px;bottom:40px;left:2px;visibility:hidden;font-weight:bold;}
</style>
<script type="text/javascript">
document.oncontextmenu=new Function("event.returnValue=false");
document.onselectstart=new Function("event.returnValue=false");
function viewList(){
var dw=80;
var dh=120;
//这个你根据需要自己获取节点的数组
//var arr = document.getElementsByTagName(‘div‘);//获取所有要显示的图标
var arr = document.getElementsByName(‘desklogo‘);//获取所有要显示的图标
var iconNum = arr.length;//获取多少个显示的图标
var screen_h = document.documentElement.clientHeight;//页面的高度
var screen_h = screen_h - 50 ;
var colNum = Math.floor(screen_h/dh);//每列显示多少个
var col = Math.ceil((iconNumdw)/screen_h);//总共能显示多少列
//document.title = "个数:"+iconNum+",高度:"+screen_h+",列数:"+col;
for(var i=0;i<iconNum;i++){
var x = (Math.floor(i/colNum))dw+10;
var y = (i%colNum)*dh+10;
arr[i].style.top = y+"px";
arr[i].style.left = x+"px";
}
}
function openapp(appurl)
{
return alert(appurl);
}
//时间数字小于10,则在之前加个“0”补位。
function check(i){
//方法一,用三元运算符
var num;
i<10?num="0"+i:num=i;
return num;
//方法二,if语句判断
//if(i<10){
// i="0"+i;
//}
//return i;
}
setInterval(function(){
var date = new Date();
var year = date.getFullYear(); //获取当前年份
var mon = date.getMonth()+1; //获取当前月份
var da = date.getDate(); //获取当前日
var day = date.getDay(); //获取当前星期几
var h = date.getHours(); //获取小时
var m = date.getMinutes(); //获取分钟
var s = date.getSeconds(); //获取秒
if(m==0 && s==0 )
location.reload();
var e = document.getElementById(‘desktime‘);
e.innerHTML=year+"年"+check(mon)+"月"+check(da)+"日<br/>"+check(h)+‘:‘+check(m)+‘<font class=\"sec\">:‘+check(s)+"</font>";
},1000);
</script>
</head>
<body onload="viewList()" onresize="viewList()">
<div id="deskbgimg" name="deskbgimg"><img src="http://lyclub.f3322.net:82/web_images/LuCaoDiLouYu.jpg" alt="桌面背景图片层" title="桌面背景图片层" /></div>
<div id="deskbgtm" name="deskbgtm"></div>
<div id="desktbar" name="desktbar">
<span style="float:left;"><img style="margin:5px;width:30px;height:30px;" src="http://pub.lyclub.f3322.net:82/images/icons/folder.png" title="开始" onclick="javascript:document.getElementById(‘startmenu‘).style.visibility=‘visible‘;"/></span>
<span id="desktime" name="desktime" style="margin:5px;float:right;font-size:14px;line-height:15px;text-align:center;color:yellow;cursor:default;"></span>
</div>
<div id="desklogo" name="desklogo" title="百度搜索" ondblclick="javascript:window.open(‘http://www.baidu.com‘);" ><img class="dlgico" src="https://www.baidu.com/favicon.ico"/><p class="dlgtit">百度搜索</p></div>
<div id="desklogo" name="desklogo" title="搜狗搜索" ondblclick="javascript:window.open(‘http://www.sogou.com‘);" ><img class="dlgico" src="https://www.sogou.com/images/logo/new/favicon.ico"/><p class="dlgtit">搜狗搜索</p></div>
<div id="desklogo" name="desklogo" title="本地公共库" ondblclick="javascript:window.open(‘http://pub.lyclub.f3322.net:82‘);" ><img class="dlgico" src="http://lyclub.f3322.net:82/web_images/32X32.ico"/><p class="dlgtit">本地公共库</p></div>
<div id="desklogo" name="desklogo" title="PUTTY" ondblclick="javascript:window.open(‘/openapp.php?//10.0.0.5/Public/tools/putty.exe‘);" ><img class="dlgico" src="http://pub.lyclub.f3322.net:82/images/icons/exe.png"/><p class="dlgtit">PUTTY</p></div>
<div id="desklogo" name="desklogo" title="AnyDesk" ondblclick="javascript:window.open(‘/openapp.php?//10.0.0.5/Public/tools/AnyDesk.exe‘);" ><img class="dlgico" src="http://pub.lyclub.f3322.net:82/images/icons/exe.png"/><p class="dlgtit">AnyDesk</p></div>
<div id="desklogo" name="desklogo" title="UltraISO" ondblclick="javascript:window.open(‘/openapp.php?//10.0.0.5/Public/tools/UltraISO_Lite9.3.exe‘);" ><img class="dlgico" src="http://pub.lyclub.f3322.net:82/images/icons/exe.png"/><p class="dlgtit">UltraISO</p></div>
<div id="startmenu" name="startmenu">
<ul style="list-style:none;padding:0px;margin:0px;text-align:center;line-height:20px;font-size:12px;">
<li style="margin:5px;border-bottom:1px solid orange" onclick="javascript:window.alert(‘列表一未开发‘);document.getElementById(‘startmenu‘).style.visibility=‘hidden‘;">列表一</li>
<li style="margin:5px;border-bottom:1px solid orange" onclick="javascript:window.open(‘/lyclub_open.reg‘);document.getElementById(‘startmenu‘).style.visibility=‘hidden‘;">注册打开的文件</li>
<li style="margin:5px;border-bottom:1px solid orange" onclick="javascript:location.reload();">刷新桌面</li>
<li style="margin:5px;border-bottom:1px solid orange" onclick="javascript:window.close();">退出桌面</li>
<li style="margin:5px;" onclick="javascript:document.getElementById(‘startmenu‘).style.visibility=‘hidden‘;">关闭菜单</li>
</ul>
</div>
</body>
</html>
共享文件夹自定义协议注册表文件
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\lyclub]
@="lyclub Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\lyclub\DefaultIcon]
@="C:\windows\system32\cmd.exe"
[HKEY_CLASSES_ROOT\lyclub\shell]
@=""
[HKEY_CLASSES_ROOT\lyclub\shell\open]
@=""
[HKEY_CLASSES_ROOT\lyclub\shell\open\command]
@="cmd /c set m=%1 & call set m=%%m:lyclub://=%% & call %%m%% & exit"
共享文件夹调用网页
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="http://lyclub.f3322.net:82/web_images/32X32.ico" />
<title>打开APP</title>
</head>
<body>
<meta http-equiv="refresh" content="0;url=lyclub://<?php echo $_SERVER["QUERY_STRING"]; ?>" />
</body>
</html>
原文地址:https://blog.51cto.com/liubingjie771/2364770