samedi 5 décembre 2020

Why isn't my JavaScript function working?

Some days ago, I asked a JS question, and it was answered. But after doing some modifications and adding new functions, it stopped working. The Js code with HTML:

        <script>
            function navigate(){
                var first = 'http://content.*****.ml/'
                var textvarjs = document.getElementById('textvar').value;
                var feature = first+textvarjs;
                location.href = feature;
        };
            function navafter{
                var one = 'http://buy.****.ml/what-next.html';
                var onesie = one.value;
                location.href = one;
        };
        </script>
    </head>
    <body>
        <p class="head">MEDIA!!</p><br><br><br>
        <p class="body-1">Type the url on your web or just type in the image directory(All the text with slashes (if there are) After media.*****/)
            here: <br></p>
        <p class="content-change">http://media.*****.ml/<input type="text" id="textvar" placeholder="Your directory here">
        <button id="btn-js" onclick="navigate()"><i class="fa fa-search fa-ig" aria-hidden="true"></i></button>
        </p>
        <p class="body-1">After choosing the desired image, <button id="btn-after" onclick="navafter()">Click here</button></p>
    </body>
</html>

The previous question link: How to use JScript to make a search bar?. Please elaborate on the button tag because this question is about the functions on buttons.




Aucun commentaire:

Enregistrer un commentaire