Error message in Javascript
<p>I have a PHP code:</p>

<pre><code>  if($billing_total&gt;$limit_to_send){

    echo '&lt;script type="text/javascript"&gt;
    window.onload = function() {
    alert("Sorry, you do not have enough credit");
 }
   &lt;/script&gt;';
</code></pre>

<p>When I am printing this message, it is being printed at the beginning of the PHP page as below:</p>

<pre><code>  &lt;script type="text/javascript"&gt;
                window.onload = function() {
                alert("Sorry, you do not have enough credit");
             }
               &lt;/script&gt;

        &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

        &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
        &lt;head&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
        -----------------------------------------------------------
</code></pre>

<p>This caused the header (logo) of my page in the browser to move down one line.</p>

<p>and the page will look very bad because all the items there will be moved down one line.</p>

<p>I hope it is clear to you. Please any solution ?</p>

<p>===========================================================================</p>

<p>Thanks for All ...</p>

<p>Solution:</p>

<pre><code>$alert_message=&lt;script type="text/javascript"&gt;
    window.onload = function() {
    alert("Sorry, you do not have enough credit");
 }
   &lt;/script&gt;
</code></pre>

<p>Printing  <code>$alert_message</code> somewhere in the HTML code before the <code>body</code> tag ^_^</p>
