Jake
Jake

Reputation: 123

Javascript show alert two times before redirect

<script type="text/javascript">
<!--

alert('You will be redirected');


window.location = "http://www.google.com/"

//-->
</script>

How to change the code so that the alert is shown twice before redirecting to google?

Upvotes: 0

Views: 810

Answers (2)

varghesekutty
varghesekutty

Reputation: 1005

<script type="text/javascript">
<--
for(vari=0;i<2;i++)
  {
    alert('You will be redirected');
  }

window.location = "http://www.google.com/"

 //-->
</script>

Upvotes: 0

Herms
Herms

Reputation: 38868

<script type="text/javascript">
<!--

alert('You will be redirected');
alert('You will be redirected');


window.location = "http://www.google.com/"

//-->
</script>

Why you'd want to do this I don't know, but that will do what you want.

Upvotes: 7

Related Questions