Why is my javascript not working

I have the following html. It passes the w3 validator, but my javascript warning is not working. Can anyone see any problems or any suggestions on how to make it work?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Company Name™</title>
        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <style type="text/css">
            BODY {
                background-image: url(images/bg4.jpg); 
                background-repeat:no-repeat; 
                background-position:center top;
                background-attachment: fixed; 
            }
        </style>
        <script type="text/javascript">
            alert("HELLO");
        </script>
    </head>
    <body>
        <div id="wrapper">
            <div id="header">
                <div class="logo">
                    <img src="images/fcflogo.png" width="295" height="100" align="left" alt="logo"/>
                </div>
                <div class="header1">
                    <a href="financialprotection.html">100% Financial Protection</a>
                    <hr/>
                </div>
                <div class="nav">Home| Flights| Hotels| Villas | CarHire| Attractions| Contact</div>
            </div>
            <div class="ver1">
                <h2>Can't find what your looking for?</h2>
            </div>
            <div class="enq1">
                <h2>Enquiry Form</h2>
            </div>
            <div class="hor1">
                <h2>Our Service</h2>
                <a>Company Name are one of the leading independent travel companies specialising in Florida Holidays. We have a wide range of major Charter and Scheduled airlines to choose from as well as over 10,000 Hotel and Villa deals. Our aim is to provide you the customer with a truly fantastic vacation in Florida from start to finish at affordable prices. We are not committed to any airline or Tour operator so are totally committed to finding you the best deal.</a>
            </div>
            <div class="hor1"><a>FLIGHTS</a></div>
            <div class="ver2"><a>HOTELS</a></div>
            <div class="ver2"><a>VILLAS</a></div>
            <div class="hor1"><a>CAR HIRE</a></div>
            <div class="hor1"><a>ATTRACTIONS</a></div>
        </div>
        <hr/>
        <div id="footer"><a>FOOTER</a></div>
    </body>
</html>

EDIT - For everyone below, I have javascript enabled, I use debian with firefox, noScript is disabled, but the warning does not appear even if I move it to the body.

+3
source share
5 answers

Take out the trademark first. These extended characters probably kill the closing tag </title>. I am sure your problem.

<script> , . , . - script .

+4

, . javascript ?

+1

FF 3 IE 8.

JavaScript ?

0

script . script , . onload body.

0

You might want to try flushing your cache to make sure your browser loads the file using alertit instead of the old cached copy. If this does not work, I suggest trying it with Firefox / Firebug and checking for errors in the javascript console. If you upload a file using AJAX, you need to move the script tag to the body of the document. In most cases, AJAX libraries will ignore the HEAD element and include only tags in the BODY tag.

0
source

Source: https://habr.com/ru/post/1765506/


All Articles