0

別のページにリダイレクトするアラートを読み込もうとしていますが、ページの背景が読み込まれないという問題があります。レンダリングされる唯一の html は、javascript アラートです。アラートの前に少なくとも一部の html が読み込まれるように、これを修正する方法はありますか?

も試した

var onFooEndFunc = function() 
{
    var delay = 50; /* milliseconds - vary as desired */
    var executionTimer;

    return function() 
    {
        if (executionTimer) 
        {
            clearTimeout(executionTimer);
        }

        executionTimer = setTimeout(function() 
        {
            window.alert('Please download a game');
            window.location.href='games.html';
        }, delay);
    };
}();
4

2 に答える 2

0

Popup is what you need

just set a div

<div id="popup_download">
  Please download a game!
    <a href="game1.exe">Mario</a>
     <a href="game2.exe">Sonice Rider</a>
</div>

at style set display:hidden

#popup_download
{
    position:absolute;
    display:none;
    top:200px;
    left:50%;
    width:500px; 
    margin-left:-250px;
    border:1px solid blue; 
    padding:20px;
    background-color:white;
}

when page is loaded just set display:block

<script type="text/javascript">
    function show_popup()
    {
      document.getElementById('popup_download').style.display = 'block'; 
    }

    window.onload = show_popup;
</script>

The benefit of it is you can add any HTML elements,css and even php or asp or any code inside and your background will continue working.

于 2013-04-21T01:47:46.527 に答える