Solution 1 :

I think it is working but the alert doesn’t get triggered because the script you refer to isn’t loaded. Try it like this:

<!DOCTYPE html>
<html>
<head>
    <link media="screen" href="style.css">
</head>
<body>
    <p>…</p>
    <img src="file.jpg" alt="" />

    <script src="responsive-nav.min.js">

    <script>
        window.onload = function () {
            console.log('Document loaded.');
            function init();
            function dosomething();
        }
    </script>
</body>
</html>

Solution 2 :

<script language="JScript.Compact">

The language attribute is obsolete, but browsers still support it.

Since you set it to an unrecognised language, browsers don’t know how to execute it, so they ignore it.

Remove the language attribute.

Problem :

When I load this page the script is not loading for some reason. What am I doing wrong here?

<html>
    <head>
        <title>hi</title>
        <script language="JScript.Compact">
            var script = document.createElement('script');
            script.onload = function() {
                alert("Script loaded and ready");
            };
            script.src = "http://192.168.1.106/js/min.js";
            document.getElementsByTagName('head')[0].appendChild(script);
        </script>
    </head>
</html>

Comments

Comment posted by Trying to fire the onload event on script tag

Does this answer your question?

Comment posted by Reporter

There is mistake in thinking of html. The head-tag is not constructed to using it as an headline. This is a structure tag for html pages. So

Comment posted by user1111111111111

Still editing the head tag with what you told did’t load the script. @Quentin This would be used in old browsers.

Comment posted by Reporter

@user1111111111111 I’ve never said it will solve your issue, I just wanted to point you to an error.

Comment posted by Spark Fountain

The function definitions in your script should have curly brackets (even if the implementation is missing here) to no get confused between function definition and function call.

By