-3

In php code, I am including the alert box to show the errors and this is working. Now I want to make stylish my alert box E.g: colors, font style, bgcolor etc.

vinS
  • 1,417
  • 5
  • 24
  • 37

2 Answers2

0

window.alert() is not customizable. You will have to use an overlay or a pop up. Don't use a pop up, though.

Fabian Klötzl
  • 407
  • 3
  • 10
0

The alert box is a system object, and not subject to CSS. To do this style of thing you would need to create an HTML element and mimic the alert() functionality. The jQuery UI Modal box does a lot of the work for you, working basically as I have described: Link.

Reference by link

Try this

<?php
     $my = "hello";

     echo "<script>alert('".$my."'); window.location.href='index.php';</script>";

 ?>
Community
  • 1
  • 1
Sumit patel
  • 3,807
  • 9
  • 34
  • 61