• Resolved globalsprawl

    (@globalsprawl)


    Hi,

    I am trying to use the following code in a page on my website. I have tested it offline and it works well, but I cant seem to get it to work when i put it into the WordPress page.

    The code in the page is:

    <script type="text/javascript" src="https://globalsprawl.com/scripts/changeit.js"></script>
    
    <div id="image1">
    <img src="https://globalsprawl.com/images/anthromes_1700.jpg" border="0" alt="one" />
    </div>
    
    <br><br>
    
    <a id="one" href="#" onclick="changeIt('https://globalsprawl.com/images/anthromes_1700.jpg','image1');">1700</a>
    <a id="two" href="#" onclick="changeIt('https://globalsprawl.com/images/anthromes_1800.jpg','image1');">1800</a>
    <a id="three" href="#" onclick="changeIt('https://globalsprawl.com/images/anthromes_1700.jpg','image1');">1900</a>
    <a id="four" href="#" onclick="changeIt('https://globalsprawl.com/images/anthromes_1700.jpg','image1');">2000</a>

    And the changeit.js file is:

    <script type="text/javascript">
    function changeIt(imageName,objName)
    {
    	var obj = document.getElementById(objName);
    
    	var imgTag = "<img src='"+imageName+"' border='0' />";
    
    	obj.innerHTML = imgTag;
    
    	return;
    }
    </script>

    I have looked at the following page, https://codex.www.ads-software.com/Using_Javascript, as well as trawling the internet, but its just evading me.

    The link to the page on the site is https://globalsprawl.com/what-is-global-sprawl/

    Thanks!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Calling JavaScript in Post – Cant Get It Working’ is closed to new replies.