user3172642
user3172642

Reputation: 13

How to change the alert box size?

How to change the alert box size? I use the following coding.

In Firefox the alert box resize automatically but it not change in chrome? Kindly give a solution.

window.alert("You answered all questions. Press OK to continue.");

Upvotes: 1

Views: 17135

Answers (3)

Asim Majeed
Asim Majeed

Reputation: 1

I placed a single space in a new line at the end of my string which increased the length to a standard Windows message box.

Alert ("Hello World\n ");

Upvotes: -1

You can't change the size/formatting/title (default settings) of the Javascript Alert Box. Instead you should check out JQuery Alert Box.

The Resizable JQuery Alert Box

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Resizable - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.9.1.js"></script>
  <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <style>
  #resizable { width: 150px; height: 150px; padding: 0.5em; }
  #resizable h3 { text-align: center; margin: 0; }
  </style>
  <script>
  $(function() {
    $( "#resizable" ).resizable();
  });
  </script>
</head>
<body>
 
<div id="resizable" class="ui-widget-content">
  <h3 class="ui-widget-header">Resizable</h3>
</div>
 
 
</body>
</html>

Upvotes: 1

unsafe_where_true
unsafe_where_true

Reputation: 6320

To clarify: When you use window.alert() you are using resources of your browser, not of your web page. It's the browser then who is responsible for creating the alert box, and thus you cannot influence its properties (like size etc.)

Upvotes: 0

Related Questions