Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript [Solved] Help with a Javascript Store Locator

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #30142
    cybershot
    Participant

    I am working on a template that needs to have a store locator. So I did a test javascript file like this

    function storeLocator()
    {
    var locations = new Array(5);

    locations[0] = “Portland”;
    locations[1] = “Seattle”;
    locations[2] = “Washington”;
    locations[3] = “Idaho”;
    locations[4] = “Utah”;

    document.write(locations[0]);
    }

    I called this locator.js. Then in the html file, put the script tag to include the js file and then in the html I tried calling it by function name like this

    but it doesn’t work. My question is a 2 parter. 1) Do you have any advice on how to write this program so that it will work on zip or city? 2) what am I doing wrong that the portland won’t show when I run the html page?

    I am new to javascript. I decided to write this program in javascript over php or any other language because it needs to be easily updateable and I figured javascript would be easiest to explain.

    #80653
    cybershot
    Participant

    never mind. I found a solution and fixed the issue of the code not showing up

    #80654
    Bob
    Member

    It may be useful to other users if you could post your solution here. :)

    #80648
    cybershot
    Participant
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.