d00rman
d00rman

Reputation: 330

How to Autoclose my alert

Is there some way i can "Autoclose" this alert?

CODE

//Echo succes
echo "<script type='text/javascript'>";
  echo "alert('Välkommen ".$row['usr_fname']." ".$row['usr_lname']."');";
  echo 'window.location = "page.php"';
echo "</script>";

Upvotes: 0

Views: 266

Answers (1)

goodpixels
goodpixels

Reputation: 523

You should consider using one of many available scripts to do so, or write a function like this yourself. For starters, have a look at the jQuery UI modal component: http://jqueryui.com/dialog/

The code could look something like this:

var $myDialog = $( '#dialog' );

$myDialog.dialog( {

    modal: true,
    open: function(){           
        setTimeout( function() { $myDialog.dialog( 'close' ); }, 3000 );    
    }

} );

Upvotes: 1

Related Questions