<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>
</head>
<body scroll="no" style="border:none;" bgcolor=black topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0 >
<img id=img name=img src="" οnmοusedοwn="movestart(this,'img')" οnmοusemοve="moving('img')" οnmοuseup="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 οnchange="changeimg(this.options[this.selectedIndex].value, this.options[this.selectedIndex].text)"
style="display:none; position:absolute; background-color:transparent;" title="手动选择图片">
</select>
<div style="border:0px solid white; position:absolute; text-align:center; font-size:600px; top:10px;" id=well></div>
<SCRIPT language="javascript">
<!--
function reportError(msg,url,line)
{
//alert("当前页的脚本发生错误: /n/n信息: " + msg + "/n/n行:" + line);
return true;
}
window.onerror = reportError;
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(objId)
{
$e(objId).style.color = "rgb(" + 255 * Math.random() + ","
+ 255 * Math.random() + ","
+ 255 * Math.random() + ")";
$e(objId).style.fontSize = 300 + Math.random() * 300;
//$e(objId).style.top = 300 * Math.random();
$e(objId).style.left = 500 * Math.random() + "px";
$e(objId).innerText = String.fromCharCode(33088 + 32190 * Math.random());//gbk
setTimeout("changeText('" + objId + "');", 1000);
}
changeText("well");
//-->
</SCRIPT>
</BODY>
</hta>