HTA Script, center button on form?

Author Message
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)
0
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">
&nbsp;&nbsp;&nbsp

</BODY>
 
#1
    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)
    0
    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>
     &nbsp;&nbsp;&nbsp
     
     </body>
     </html>
     

    dm_4ever

    My philosophy: K.I.S.S - Keep It Simple Stupid
    Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
    Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      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)
      0
      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>
       

       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9