Reputation: 123
<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
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
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