首页 > 编程 > HTA > 正文

用hta实现的桌面漂浮flash

2020-01-31 15:42:16
字体:
来源:转载
供稿:网友
用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="//files.VeVB.COm/demoimg/200912/qqpet.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><PARAM NAME=bgcolor value=#FFFFFF><embed src="//files.VeVB.COm/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>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表