simonc1970
-
Total Posts
:
26
- Scores: 0
-
Reward points
:
0
- Joined: 5/7/2007
-
Status: offline
|
HTA Script, center button on form?
Wednesday, August 01, 2007 9:59 AM
( permalink)
Hello, can anyone tell me how to make the reboot button in my HTA script be centered on the from when it loads? <html> <head> <title>Boehringer Ingelheim Image Download PE4</title> <HTA:APPLICATION ID="MapShare" INNERBORDER="no" BORDER="dialog" MAXIMIZEBUTTON="no" MINIMIZEBUTTON="no" CONTEXTMENU="no" APPLICATIONNAME="MapShare" SCROLL="no" SINGLEINSTANCE="yes" WINDOWSTATE="maximize" > </head> </Script><Body> <P> <body STYLE="font:13 pt arial; color:white; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#000000', EndColorStr='#0000FF')" onContextMenu="copyRight"> <BR> <BR> <input id=runbutton class="button" type="button" value="Reboot Computer" name="ok_button" onClick="RunReboot">   </BODY>
|
|
|
|
dm_4ever
-
Total Posts
:
3687
- Scores: 82
-
Reward points
:
0
- Joined: 6/29/2006
- Location: Orange County, California
-
Status: offline
|
RE: HTA Script, center button on form?
Wednesday, August 01, 2007 12:11 PM
( permalink)
You mean like this...
<html>
<head>
<title>Boehringer Ingelheim Image Download PE4</title>
<head>
<script></script>
<HTA:APPLICATION
ID="MapShare"
INNERBORDER="no"
BORDER="dialog"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="no"
CONTEXTMENU="no"
APPLICATIONNAME="MapShare"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximize"
>
</head>
<body>
<P>
<body STYLE="font:13 pt arial; color:white;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0, StartColorStr='#000000', EndColorStr='#0000FF')" onContextMenu="copyRight">
<BR>
<BR>
<div align="center"><input id=runbutton class="button" type="button" value="Reboot Computer" name="ok_button"
onClick="RunReboot"></div>
 
</body>
</html>
|
|
|
|
Rischip
-
Total Posts
:
519
- Scores: 2
-
Reward points
:
0
- Joined: 3/26/2007
-
Status: offline
|
RE: HTA Script, center button on form?
Wednesday, August 01, 2007 1:42 PM
( permalink)
That will work centered left to right. This will work absolute center and will adjust where center is when a resize event occurs.
<html>
<head>
<title>Boehringer Ingelheim Image Download PE4</title>
<HTA:APPLICATION
ID="MapShare"
INNERBORDER="no"
BORDER="dialog"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="no"
CONTEXTMENU="no"
APPLICATIONNAME="MapShare"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximize"
>
<script language=vbscript>
Sub Window_Onload
posBtn
document.body.onresize = GetRef("posBtn")
End Sub
Sub posBtn
Dim btn
Set btn=document.getelementbyid("runbutton")
Set bod=document.getelementbyid("mainbody")
topLoc = (bod.offsetHeight/2) - (btn.offsetHeight/2)
leftLoc = (bod.offsetWidth/2) - (btn.offsetWidth/2)
btn.style.position="absolute"
btn.style.posTop = topLoc
btn.style.posLeft = leftLoc
End Sub
</Script>
</head>
<body id="mainbody" STYLE="font:13 pt arial; color:white;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0, StartColorStr='#000000', EndColorStr='#0000FF')" onContextMenu="copyRight">
<BR>
<BR>
<input id=runbutton type="button" value="Reboot Computer" name="ok_button" onClick="RunReboot">
</body>
</html>
|
|
|
|