質問

I have found some code for a splash screen but I need to fix one problem:

When I run my HTA program the splash screen pops up as normal. But if I click onto my desktop the splash screen goes away, is there any way to fix this problem?

<html>
<head>
  <title>Splash Screen</title>
  <script type="text/vbscript">
  Dim oPopup
  Set oPopup = window.createPopup()

  Function goContext()
    Dim oPopupBody
    Set oPopupBody= oPopup.document.body
    oPopupBody.innerHTML = oContext.innerHTML
    call oPopup.show(275, 200, 400, 300, document.body)
  End Function
  </script>
</head>
<body onload="goContext()" onmousedown="oPopup.hide">
  <!-- Splash Screen -->
  <div ID="oContext" style="display:none" onselectstart="return false" ondragstart="return false" oncontextmenu="return false">
            <div style="position:absolute; top:0; left:0; width:400px; height:300px; border:1px solid black; background:#eeeeee;" onselectstart="return false" ondragstart="return false" oncontextmenu="return false">
      <div style="padding:20px; background:white; border-bottom:5px solid #cccccc" onselectstart="return false" ondragstart="return false" oncontextmenu="return false">
        <b onselectstart="return false" ondragstart="return false" oncontextmenu="return false"><h2 align="center"><i>Game Launcher </i><small><sub>ver: 1.00</sub></small></h2></b>
      </div>
      <div style="padding:20px; font-size:8pt; line-height:1.5em; font-family:verdana; color:black;" onselectstart="return false" ondragstart="return false" oncontextmenu="return false">
        <center onselectstart="return false" ondragstart="return false" oncontextmenu="return false">
          <marquee DIRECTION="UP" HEIGHT="100" WIDTH="300" SCROLLAMOUNT="1" onselectstart="return false">Le text goes here</marquee>
          <br /><br />
          <b>&#169;2013 Petzl11 Development.</b>
        </center>
      </div>
    </div>
  </div>
  <center>
    <button onclick="goContext()">Show Splash Screen</button><br>
    <b>Internet Explorer Only!</b>
  </center>
</body>
</html>

This is what I originally wanted to make, but this one you helped me with is perfect, this one below is .vbs: Here is the link

役に立ちましたか?

解決

Working code, after some interactive debugging (a style attribute was not closed correctly).

<html>
<head>
  <HTA:APPLICATION selection="no" contextmenu="no" />
  <title>Splash Screen</title>
  <script type="text/vbscript">
  Dim oPopup
  Set oPopup = window.createPopup()

  Function goContext()
    Dim oPopupBody
    Set oPopupBody= oPopup.document.body
    oPopupBody.innerHTML = oContext.innerHTML
    call oPopup.show(275, 200, 400, 300, document.body)
  End Function
  </script>
</head>
<body onload="goContext()" onmousedown="oPopup.hide">
  <!-- Splash Screen -->
  <div ID="oContext" style="display:none">
    <div style="position:absolute; top:0; left:0; width:400px; height:300px; border:1px solid black;background:#eeeeee;">
      <div style="padding:20px; background:white; border-bottom:5px solid #cccccc">
        <b><h2 align="center"><i>Game Launcher</i> <small><sub>ver: 1.00</sub></small></h2></b>
      </div>
      <div style="padding:20px; font-size:8pt; line-height:1.5em; font-family:verdana; color:black;">
        <center>
          <marquee direction="up" height="100" width="300" scrollamount="1">Le text goes here</marquee>
          <br><br>
          <b>&#169;2013 Petzl11 Development.</b>
        </center>
      </div>
    </div>
  </div>
  <!-- End Splash Screen -->
  <center>
    <button onclick="goContext()">Show Splash Screen</button><br>
    <b>Internet Explorer Only!</b>
  </center>
</body>
</html>

Note the <HTA:APPLICATION> element and read through its documentation.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top