用hta实现的桌面漂浮flash
2016-06-30来源:

用window.createpopup()成功实现了在桌面显示一个无窗口的flash.

将下面的代码,保存为qq.hta,双击运行即可。关闭方法,任务管理器中关闭mshta.exe即可。

代码如下:

<hta:application id=ohta

applicationname=myapp

border=none

caption=no

icon=filename.ico

maximizebutton=no

minimizebutton=no

showintaskbar=no

ingleinstance=no

sysmenu=no

version=1.0

windowstate=minimize

/>

<script language=javascript type=text/javascript>

function mm_reloadpage(init) { //reloads the window if nav4 resized

if (init==true) with (navigator) {if ((appname==netscape)&&(parseint(appversion)==4)) {

document.mm_pgw=innerwidth; document.mm_pgh=innerheight; onresize=mm_reloadpage; }}

else if (innerwidth!=document.mm_pgw || innerheight!=document.mm_pgh) location.reload();

}

mm_reloadpage(true);

var imagewidth=200 //这两行写弹出窗口的大小

var imageheight=200

var speed=3;

var isie=0;

if(window.navigator.appname==microsoft internet explorer&&window.navigator.appversion.substring(window.navigator.appversion.indexof(msie)+5,window.navigator.appversion.indexof(msie)+8)>=5.5) {

isie=1;

}

else {

isie=0;

}

function pop() {

if(isie) {

x=x+dx;y=y+dy;

opopup.show(x, y, imagewidth, imageheight);

if(x+imagewidth+5>screen.width) dx=-dx;

if(y+imageheight+5>screen.height) dy=-dy;

if(x<0) dx=-dx;

if(y<0) dy=-dy;

startani=settimeout(pop();,50);

}

}

if(isie) {

var str='<object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 width=200 height=200><param name=movie value=http://files.jb51.net/demoimg/200912/qqpet.swf /><param name=quality value=high /><param name=wmode value=transparent /><param name=bgcolor value=#ffffff><embed src=http://files.jb51.net/demoimg/200912/qqpet.swf wmode=transparent quality=high pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash width=300 height=190></embed></object>';

var x=0,y=0,dx=speed,dy=speed;

var opopup = window.createpopup();

var opopupbody = opopup.document.body;

//opopup.document.bgcolor=orange; //桔黄色背景颜色

opopup.document.bgcolor=#ffffff; //白色背景

opopupbody.innerhtml = str;

pop();

}

</script>

推荐信息
Baidu
map