<hta>
<HTA:APPLICATION ID="desktopHTA"
APPLICATIONNAME="myApp"
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="0">
<title>自动换背景程序</title>
<style>
.selectSpan
{
border:1px solid #0a246a;
background:#316ac5;
}
.unSelectSpan
{
border:1px solid #d4d0c8;
}
</style>
</head>
<body scroll="no" style="border:none;" bgcolor=black topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0 >
<img id=img name=img src="" onmousedown="movestart(this,'img')" onmousemove="moving('img')" onmouseup="moveend()"
style="padding: 0px; margin: 0px; left:0px; top:0px; background-color:transparent; position:absolute; color: red; FILTER: revealtrans(duration=2.0,transition=23); border:0px; display:none; " >
<select id=pathselect width=50 onchange="changeimg(this.options[this.selectedIndex].value, this.options[this.selectedIndex].text)"
style="display:none; position:absolute; background-color:transparent;" title="手动选择图片">
</select>
<div id=testDiv style="display:none; position:absolute; border:1px solid #808080; color:black;
background:#d4d0c8; font-size:13px; font-family:'宋体'; padding:5px,5px,5px,5px;
cursor:default;text-align:right;">
<span style="width:265px; height:15px;
border:1px solid #0a246a;
background:#316ac5; text-align:center;" onmousedown="movestart(this,'testDiv')" onmousemove="moving('testDiv')" onmouseup="moveend()"
onselectstart="return false;">调试窗口</span>
<span onclick=showTest(0) onselectstart="return false;" onmouseover="this.style.color='blue';"
onmouseout="this.style.color='black';" style="cursor:hand;">关闭</span><br>
<textarea style="width:300px; height:100px;" onkeypress="if (event.keyCode == 10){eval(this.value)}">
</textarea>
</div>
<OBJECT ID="sound"
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" style="width:0px; height:0px; display:none;">
<PARAM name="autoStart" value="false">
<param name="volume" value="100">
<param name="url" value="D:/Program Files/freeime/sound/back.wav">
</OBJECT>
<div id=well style="word-break:break-all; position:absolute; font-family:'华文彩云'; FILTER: revealtrans(duration=2.0,transition=23);">
</div>
<div id=myMune style="display:none; position:absolute; border:1px solid #808080; width:170px; color:black;
background:#d4d0c8; font-size:13px; font-family:'宋体'; padding:5px,5px,5px,10px; cursor:default;" >
<div onclick="location.reload();" onmouseover="changeSpan(1,this);" onmouseout="changeSpan(0,this);"
class=unSelectSpan
>刷新(<span style="text-decoration:underline;">f5</span>)</div>
<div
class=unSelectSpan onmouseover="changeSpan(1,this);" onmouseout="changeSpan(0,this);"
onclick="showTest(1);">调试</div>
<hr width=100% disabled>
<div
class=unSelectSpan onmouseover="changeSpan(1,this);" onmouseout="changeSpan(0,this);"
onclick="if (this.innerText.indexOf('开始') > -1){changeText(1, 'well');this.innerText = '停止桌面变换';}else{changeText(0);this.innerText = '开始桌面变换';}">开始桌面变换</div>
</div>
<SCRIPT language="javascript">
<!--
var timer;
function reportError(msg,url,line)
{
//alert("当前页的脚本发生错误: /n/n信息: " + msg + "/n/n行:" + line);
return true;
}
window.onerror = reportError;
function showMymune(yes)
{
if (yes)
{
var e = event;
myMune.style.top = e.y;
myMune.style.left = e.x;
myMune.style.display = "";
}else
{
myMune.style.display = "none";
}
}
function showTest(yes)
{
if (yes)
{
testDiv.style.display = "";
}else
{
testDiv.style.display = "none";
}
}
function document.body.oncontextmenu()
{
showMymune(1);
return false;
}
function document.body.onkeypress()
{
showMymune(0);
}
function document.body.onclick()
{
showMymune(0);
}
function changeSpan(yes, e)
{
if (yes)
{
e.className = "selectSpan";
}else
{
e.className = "unSelectSpan";
}
}
var pass;
var bodytitle = "hhhh/n/n点右键随机换图片/n"
+ "按CTRL+T在左上角自选图片/n"
+ "SHIFT+D删除当前显示图片/n"
+ "ctrl+L锁定图片/n"
+ "新加入图片后按F5刷新载入图片路径";
var picpath = "F://My Documents//My Pictures";//图片路径
document.body.title = bodytitle;
var moveobj = null;
var xx = 0 ;
var yy = 0;
function movestart(o,n)
{
moveobj = o;
moveobj.setCapture();
xx = event.x - eval(n).offsetLeft;
yy = event.y - eval(n).offsetTop;
}
function moving(n)
{
if(moveobj != null){
eval(n).style.left = event.x - xx;
eval(n).style.top = event.y - yy;
}
}
function moveend()
{
moveobj.releaseCapture();
moveobj = null;
}
function window.onload()
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
if ( fso.folderExists(picpath) == false)
{
document.body.title = picpath + " 文件夹不存在请创建并下载图片再使用!";
return false;
}
var foldersarray = new Array();
foldersarray[0] = picpath;
getfolders(fso, foldersarray);
}
function getfolders(fso, foldersarray){
var fp = foldersarray[0];
try{
fp = fso.getFolder(fp).subFolders;
fp = new Enumerator(fp);
for(; !fp.atEnd(); fp.moveNext()){
foldersarray[foldersarray.length] = fp.item();
}
}catch(e){}
getfiles(fso, foldersarray);
}
function getfiles(fso, foldersarray){
var o = foldersarray.splice(0,1);
try{
o = fso.getfolder(o).files;
o = new Enumerator(o);
var newoption;
for(; !o.atEnd(); o.moveNext()){
if(o.item().name.match(".+/.(jpg)|(gif)|(bmp)|(JPG)|(GIF)|(BMP)$","ig"))
{
newoption = pathselect.insertAdjacentElement("beforeEnd",document.createElement("OPTION"));
newoption.value = o.item().path;
newoption.text = pathselect.options.length + ". " + o.item().name;
}
}
}catch(e){alert(e.description)}
if(foldersarray.length > 0)
{
getfolders(fso, foldersarray);
}else
{
if ( pathselect.options.length == 0)
{
document.body.title = "在[F://qidizi相片]文件夹中不存在图片文件,请增加再使用!";
return false;
}
window.document.body.oncontextmenu = function ()
{
randompath();
return false;
}
document.onkeypress = function ()
{
keyevent();
}
}
}
function delimg(path)
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
try
{
if( window.confirm( "你确定要删除图片吗(确定请选择YES,否请选择NO):/n/n" + path ) )
{
fso.deleteFile( path );
location.reload();
}
}catch(e)
{
alert("删除图片/n/n" + path + "/n/n出错!/n/n" + e.description );
}
}
function keyevent()
{
if(iflock() == false)
{
return false;
}
switch(e = event.keyCode)
{
case 12://ctrl+L
pass = "";
break;
case 20://ctrl+t
if(pathselect.style.display == "")
{
pathselect.style.display = "none";
}else
{
pathselect.style.display = "";
}
break;
case 68://shift+d
delimg( pathselect.value );
break;
default:
//alert(e + "键未有相应的执行方法!请添加!");
}
}
function randompath()
{
var ranindex = Math.floor(Math.random() * pathselect.options.length);
var thisoption = pathselect.options[ranindex];
thisoption.selected = true;
changeimg(thisoption.value,thisoption.text);
}
function changeimg(path,title)
{
if(iflock() == false)
{
return false;
}
var count = Math.floor(Math.random() * 23);
img.style.display = "";
img.filters[0].apply();
img.filters.revealtrans.transition = count;
img.style.left = "0px";
img.style.top = "0px";
img.src = path;
img.filters[0].play();
img.title = "图片路径:/n" + title + bodytitle;
}
function iflock()
{
if(pass == "qidizi")
{
return true;
}else
{
return ((pass = prompt("请输入换图片的密码!","")) == "qidizi");
}
}
function $e(objId)
{
return document.getElementById(objId);
}
function changeText(yes, objId)
{
if (yes)
{
colorR(objId);
$e(objId).style.fontSize = 300 + Math.random() * 300;
$e(objId).style.top = 10 + 160 * Math.random();
$e(objId).style.left = 10 + 400 * Math.random() + "px";
var count = Math.floor(Math.random() * 23);
$e(objId).filters[0].apply();
$e(objId).filters.revealtrans.transition = count;
$e(objId).filters[0].play();
$e(objId).innerText = getString();//String.fromCharCode(33088 + 32190 * Math.random());//gbk
timer = setTimeout("changeText(1, '" + objId + "');", 1000);
}else
{
clearTimeout(timer);
}
}
function colorR(objId)
{
$e(objId).style.color = "rgb(" + 255 * Math.random() + ","
+ 255 * Math.random() + ","
+ 255 * Math.random() + ")";
}
function getString()
{
var re, code;
do
{
code = 19968 + Math.floor(20901 * Math.random());
re = String.fromCharCode(code);
}while (re == String.fromCharCode(61867))
return re;
}
function typeText(objId, maxLen, i)
{
if (isNaN(maxLen) || (maxLen < 0))
{
maxLen = 120;
$e(objId).style.fontSize = "50px";
$e(objId).innerText = "";
}
maxLen--;
colorR(objId);
$e(objId).innerText += getString();//gbk
//sound.controls.play();
setTimeout("typeText('" + objId + "', " + maxLen + ");", 500);
}
//typeText("well");
//-->
</SCRIPT>
</BODY>
</hta>