azerica
azerica

Reputation: 11

I am a very new coder and it says missing semi-colon

I am adding html/javascript to shogun app on shopify. I copied this from a youtube video because shogun doesn't offer this functionality. I am not a coder, just dabble in it. It says missing semi-colon but I can't find it.

It should be a dropdown menu that goes directly to a website. Can you help. See code

<!doctype html>

<html lang="en">
<head>
    <title>Choose your current brand</title>
</head>
<body>
    <h1> this is where the header 1 tag goes</h1>
    <form name="competitor brands">
        <select name="Brand" id="Brand">
            <option value="nothing" seleted="selected">Select a Brand </option>
            <option value="https://www.goodhousekeeping.com/life/pets/g4531/cutest-dog-breeds/">Active Wow</option>
            <option value="https://www.goodhousekeeping.com/life/pets/g4531/cutest-dog-breeds/">Brand 2</option>
            <option value="https://www.goodhousekeeping.com/life/pets/g4531/cutest-dog-breeds/">Brand 3</option>
            <option value="https://www.goodhousekeeping.com/life/pets/g4531/cutest-dog-breeds/">Brand 4</option>
            <option value="https://www.goodhousekeeping.com/life/pets/g4531/cutest-dog-breeds/">Brand 5</option>
            </select>
    </form>

    <script type="text/javascript">
        var urlMenu = document.getElementById ('Brand');
        urlMenu.onchange = function() {
            var userOption = this.options[this.selectedIndex];
            if (userOption.value !=-"nothing") {
                windwow.open (userOption.value, "Competitor Brand Ingredients","");
            }
        }
    </script>
</body>
</html>

Upvotes: 1

Views: 181

Answers (1)

GSP KS
GSP KS

Reputation: 2053

Maybe it's because of the misspelling and the syntax error in your code. See below code that has been modified a bit:

<!doctype html>

<html lang="en">
<head>
    <title>Choose your current brand</title>
</head>
<body>
    <h1> this is where the header 1 tag goes</h1>
    <form name="competitor brands">
        <select name="Brand" id="Brand">
            <option value="nothing" seleted="selected">Select a Brand </option>
            <option value="https://www.goodhousekeeping.com/life/pets/g4531/cutest-dog-breeds/">Active Wow</option>
            <option value="https://www.goodhousekeeping.com/life/pets/g4531/cutest-dog-breeds/">Brand 2</option>
            <option value="https://www.goodhousekeeping.com/life/pets/g4531/cutest-dog-breeds/">Brand 3</option>
            <option value="https://www.goodhousekeeping.com/life/pets/g4531/cutest-dog-breeds/">Brand 4</option>
            <option value="https://www.goodhousekeeping.com/life/pets/g4531/cutest-dog-breeds/">Brand 5</option>
            </select>
    </form>

    <script type="text/javascript">
        var urlMenu = document.getElementById ('Brand');
        urlMenu.onchange = function() {
            var userOption = this.options[this.selectedIndex];
            if (userOption.value !== "nothing") { //BEFORE: if (userOption.value !=-"nothing") {
                window.open (userOption.value, "Competitor Brand Ingredients",""); //BEFORE: windwow.open (userOption.value, "Competitor Brand Ingredients","");

                // To just redirect to the URL:
                // window.open (userOption.value);

                // To open the URL in a new tab:
                // window.open (userOption.value, '_blank');
            }
        }
    </script>
</body>
</html>

Upvotes: 2

Related Questions