我有以下代码显示一张名为Test1.png的图像
图片本身正确显示时,第一次打开时,大的白色正方形会在图片打开前闪烁一秒钟。
如何摆脱这种闪烁一秒钟的形状。
代码:
<html>
<HTA:APPLICATION ID = "oHTA"
BORDER = "none"
BORDERSTYLE = "normal"
CAPTION = "no"
CONTEXTMENU = "no"
SYSMENU = "no"
NAVIGABLE = "no"
INNERBORDER = "no"
SCROLL = "no"
SELECTION = "no"
SINGLEINSTANCE = "yes"
WINDOWSTATE = "normal"
SHOWINTASKBAR = "no"
/>
<head>
<meta http-equiv="x-ua-compatible" content="ie=9">
<style type="text/css">
body {
background-color: red;
border-color: red;
margin-top: -1px;
margin-left: -1px;
margin-bottom: -1px;
margin-right: -1px;
}
</style>
<script language="VBScript">
Option Explicit
Dim width, height
width = 478 -1 '''
height = 50 -1 '''
Sub window_onload()
CenterWindow width, height
End Sub
Sub CenterWindow( widthX, heightY )
self.ResizeTo widthX, heightY
self.MoveTo (screen.availWidth - widthX)/2, (screen.availHeight - heightY)/2
End Sub
</script>
</head>
<body>
<img src="Test1.png"/>
</body>
</html>
答案 0 :(得分:2)
如果事先知道HTA窗口的大小和位置,请从window.onload
中进行调整大小和重新定位,并将其作为脚本中的第一个动作,然后在重新定位后移动<hta>
标签/在头部调整大小。之所以可行,是因为在执行<hta>
之前放置的所有代码之前,窗口是不可见的。
<html>
<head>
<meta http-equiv="x-ua-compatible" content="ie=9">
<style type="text/css">
body {
background-color: red;
border-color: red;
margin-top: -1px;
margin-left: -1px;
margin-bottom: -1px;
margin-right: -1px;
}
</style>
<script language="VBScript">
Option Explicit
Dim width, height
width = 478 -1 '''
height = 50 -1 '''
self.ResizeTo width, height
self.MoveTo (screen.availWidth - width)/2, (screen.availHeight - height)/2
</script>
<HTA:APPLICATION ID = "oHTA"
BORDER = "none"
BORDERSTYLE = "normal"
CAPTION = "no"
CONTEXTMENU = "no"
SYSMENU = "no"
NAVIGABLE = "no"
INNERBORDER = "no"
SCROLL = "no"
SELECTION = "no"
SINGLEINSTANCE = "yes"
WINDOWSTATE = "normal"
SHOWINTASKBAR = "no"
/>
</head>