我让以下代码显示一个名为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>
当您事先知道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>