mercredi 30 mai 2018

image change onclick not working!! help needed

Hi i want to make a program that changes the image when i click on it this is the code:

 <!DOCTYPE html>
<html>
<head>
    <title>logo change</title>
    <script type="text/javascript">
        var image_tracker="f"
        function change() {
            var image=document.getElementByid('social');
            if (image_tracker=="f") {
                image.src="twit.jpg"
                image_tracker="t"
            }
            if (image_tracker=="t") {
                image.src="fb.jpeg"
                image_tracker="f"
            } 
        }

    </script>
</head>
<body>
<img src="fb.jpeg" id="social" onclick="change()">
</body>
</html>

i tried the same as the person on youtube did LINK:https://www.youtube.com/watch?v=SGKXZUGe2sw

Aucun commentaire:

Enregistrer un commentaire