Javascript parsing error token(details are as follows)











up vote
0
down vote

favorite















 document.getElementById("button").onclick = function(){myFunction();

function myFunction() {
var random = Math.floor((Math.random() * 78) + 1);
document.getElementById("demo").innerHTML = random;
} // error is stated here

<!DOCTYPE html>
<html>
<head>
<script type = "text/javascript" src = "script.js"></script>
<link rel= "stylesheet" type = "text/css" href ="mystyle.css">
</head>
<body>
<Table>
<tr>
<td class = "bingocell" id = 1>1</td>
<td class = "bingocell" id = 2>2</td>
<td class = "bingocell" id = 3>3</td>
<td class = "bingocell" id = 4>4</td>
<td class = "bingocell" id = 5>5</td>
</tr>
<tr>
<td class = "bingocell" id = 6>1</td>
<td class = "bingocell" id = 7>2</td>
<td class = "bingocell" id = 8>3</td>
<td class = "bingocell" id = 9>4</td>
<td class = "bingocell" id = 10>5</td>
</tr>
<tr>
<td class = "bingocell" id = 11>1</td>
<td class = "bingocell" id = 12>2</td>
<td class = "bingocell" id = 13>3</td>
<td class = "bingocell" id = 14>4</td>
<td class = "bingocell" id = 15>5</td>
</tr>
<tr>
<td class = "bingocell" id = 16>1</td>
<td class = "bingocell" id = 17>2</td>
<td class = "bingocell" id = 18>3</td>
<td class = "bingocell" id = 19>4</td>
<td class = "bingocell" id = 20>5</td>
</tr>
<tr>
<td class = "bingocell" id = 21>1</td>
<td class = "bingocell" id = 22>2</td>
<td class = "bingocell" id = 23>3</td>
<td class = "bingocell" id = 24>4</td>
<td class = "bingocell" id = 25>5</td>
</tr>

</Table>

<p>Click the button to display a random number between 1 and 78.</p>

<button id = "button" onclick = "myFunction()">Try it</button>

<p id="demo"></p>



</body>
</html>





Errors:
ERROR: 'document' is not defined. [no-undef] document.getElementById("button").onclick = function(){myFunction()};
4

ERROR: 'x' is assigned a value but never used. [no-unused-vars] var x = document.getElementById("demo");
4

ERROR: 'document' is not defined. [no-undef] var x = document.getElementById("demo");
6

ERROR: 'document' is not defined. [no-undef] document.getElementById("demo").innerHTML = random



Things to note:
-File location of JS and CSS are in the exam same folder.
-I never really learnt to write external JS so I don't understand differences between internal and external but what works internally doesn't seem to work externally and it's very frustrating.










share|improve this question
























  • Welcome to StackOverflow! Can you also provide the HTML for the code, and also more details regarding the exact error message?
    – Andreas
    Nov 8 at 4:02










  • } is missing at the end of function(){myFunction();
    – rv7
    Nov 8 at 4:03










  • Edit your question to add the HTML, don't add it in a comment.
    – RobG
    Nov 8 at 4:24















up vote
0
down vote

favorite















 document.getElementById("button").onclick = function(){myFunction();

function myFunction() {
var random = Math.floor((Math.random() * 78) + 1);
document.getElementById("demo").innerHTML = random;
} // error is stated here

<!DOCTYPE html>
<html>
<head>
<script type = "text/javascript" src = "script.js"></script>
<link rel= "stylesheet" type = "text/css" href ="mystyle.css">
</head>
<body>
<Table>
<tr>
<td class = "bingocell" id = 1>1</td>
<td class = "bingocell" id = 2>2</td>
<td class = "bingocell" id = 3>3</td>
<td class = "bingocell" id = 4>4</td>
<td class = "bingocell" id = 5>5</td>
</tr>
<tr>
<td class = "bingocell" id = 6>1</td>
<td class = "bingocell" id = 7>2</td>
<td class = "bingocell" id = 8>3</td>
<td class = "bingocell" id = 9>4</td>
<td class = "bingocell" id = 10>5</td>
</tr>
<tr>
<td class = "bingocell" id = 11>1</td>
<td class = "bingocell" id = 12>2</td>
<td class = "bingocell" id = 13>3</td>
<td class = "bingocell" id = 14>4</td>
<td class = "bingocell" id = 15>5</td>
</tr>
<tr>
<td class = "bingocell" id = 16>1</td>
<td class = "bingocell" id = 17>2</td>
<td class = "bingocell" id = 18>3</td>
<td class = "bingocell" id = 19>4</td>
<td class = "bingocell" id = 20>5</td>
</tr>
<tr>
<td class = "bingocell" id = 21>1</td>
<td class = "bingocell" id = 22>2</td>
<td class = "bingocell" id = 23>3</td>
<td class = "bingocell" id = 24>4</td>
<td class = "bingocell" id = 25>5</td>
</tr>

</Table>

<p>Click the button to display a random number between 1 and 78.</p>

<button id = "button" onclick = "myFunction()">Try it</button>

<p id="demo"></p>



</body>
</html>





Errors:
ERROR: 'document' is not defined. [no-undef] document.getElementById("button").onclick = function(){myFunction()};
4

ERROR: 'x' is assigned a value but never used. [no-unused-vars] var x = document.getElementById("demo");
4

ERROR: 'document' is not defined. [no-undef] var x = document.getElementById("demo");
6

ERROR: 'document' is not defined. [no-undef] document.getElementById("demo").innerHTML = random



Things to note:
-File location of JS and CSS are in the exam same folder.
-I never really learnt to write external JS so I don't understand differences between internal and external but what works internally doesn't seem to work externally and it's very frustrating.










share|improve this question
























  • Welcome to StackOverflow! Can you also provide the HTML for the code, and also more details regarding the exact error message?
    – Andreas
    Nov 8 at 4:02










  • } is missing at the end of function(){myFunction();
    – rv7
    Nov 8 at 4:03










  • Edit your question to add the HTML, don't add it in a comment.
    – RobG
    Nov 8 at 4:24













up vote
0
down vote

favorite









up vote
0
down vote

favorite














 document.getElementById("button").onclick = function(){myFunction();

function myFunction() {
var random = Math.floor((Math.random() * 78) + 1);
document.getElementById("demo").innerHTML = random;
} // error is stated here

<!DOCTYPE html>
<html>
<head>
<script type = "text/javascript" src = "script.js"></script>
<link rel= "stylesheet" type = "text/css" href ="mystyle.css">
</head>
<body>
<Table>
<tr>
<td class = "bingocell" id = 1>1</td>
<td class = "bingocell" id = 2>2</td>
<td class = "bingocell" id = 3>3</td>
<td class = "bingocell" id = 4>4</td>
<td class = "bingocell" id = 5>5</td>
</tr>
<tr>
<td class = "bingocell" id = 6>1</td>
<td class = "bingocell" id = 7>2</td>
<td class = "bingocell" id = 8>3</td>
<td class = "bingocell" id = 9>4</td>
<td class = "bingocell" id = 10>5</td>
</tr>
<tr>
<td class = "bingocell" id = 11>1</td>
<td class = "bingocell" id = 12>2</td>
<td class = "bingocell" id = 13>3</td>
<td class = "bingocell" id = 14>4</td>
<td class = "bingocell" id = 15>5</td>
</tr>
<tr>
<td class = "bingocell" id = 16>1</td>
<td class = "bingocell" id = 17>2</td>
<td class = "bingocell" id = 18>3</td>
<td class = "bingocell" id = 19>4</td>
<td class = "bingocell" id = 20>5</td>
</tr>
<tr>
<td class = "bingocell" id = 21>1</td>
<td class = "bingocell" id = 22>2</td>
<td class = "bingocell" id = 23>3</td>
<td class = "bingocell" id = 24>4</td>
<td class = "bingocell" id = 25>5</td>
</tr>

</Table>

<p>Click the button to display a random number between 1 and 78.</p>

<button id = "button" onclick = "myFunction()">Try it</button>

<p id="demo"></p>



</body>
</html>





Errors:
ERROR: 'document' is not defined. [no-undef] document.getElementById("button").onclick = function(){myFunction()};
4

ERROR: 'x' is assigned a value but never used. [no-unused-vars] var x = document.getElementById("demo");
4

ERROR: 'document' is not defined. [no-undef] var x = document.getElementById("demo");
6

ERROR: 'document' is not defined. [no-undef] document.getElementById("demo").innerHTML = random



Things to note:
-File location of JS and CSS are in the exam same folder.
-I never really learnt to write external JS so I don't understand differences between internal and external but what works internally doesn't seem to work externally and it's very frustrating.










share|improve this question


















 document.getElementById("button").onclick = function(){myFunction();

function myFunction() {
var random = Math.floor((Math.random() * 78) + 1);
document.getElementById("demo").innerHTML = random;
} // error is stated here

<!DOCTYPE html>
<html>
<head>
<script type = "text/javascript" src = "script.js"></script>
<link rel= "stylesheet" type = "text/css" href ="mystyle.css">
</head>
<body>
<Table>
<tr>
<td class = "bingocell" id = 1>1</td>
<td class = "bingocell" id = 2>2</td>
<td class = "bingocell" id = 3>3</td>
<td class = "bingocell" id = 4>4</td>
<td class = "bingocell" id = 5>5</td>
</tr>
<tr>
<td class = "bingocell" id = 6>1</td>
<td class = "bingocell" id = 7>2</td>
<td class = "bingocell" id = 8>3</td>
<td class = "bingocell" id = 9>4</td>
<td class = "bingocell" id = 10>5</td>
</tr>
<tr>
<td class = "bingocell" id = 11>1</td>
<td class = "bingocell" id = 12>2</td>
<td class = "bingocell" id = 13>3</td>
<td class = "bingocell" id = 14>4</td>
<td class = "bingocell" id = 15>5</td>
</tr>
<tr>
<td class = "bingocell" id = 16>1</td>
<td class = "bingocell" id = 17>2</td>
<td class = "bingocell" id = 18>3</td>
<td class = "bingocell" id = 19>4</td>
<td class = "bingocell" id = 20>5</td>
</tr>
<tr>
<td class = "bingocell" id = 21>1</td>
<td class = "bingocell" id = 22>2</td>
<td class = "bingocell" id = 23>3</td>
<td class = "bingocell" id = 24>4</td>
<td class = "bingocell" id = 25>5</td>
</tr>

</Table>

<p>Click the button to display a random number between 1 and 78.</p>

<button id = "button" onclick = "myFunction()">Try it</button>

<p id="demo"></p>



</body>
</html>





Errors:
ERROR: 'document' is not defined. [no-undef] document.getElementById("button").onclick = function(){myFunction()};
4

ERROR: 'x' is assigned a value but never used. [no-unused-vars] var x = document.getElementById("demo");
4

ERROR: 'document' is not defined. [no-undef] var x = document.getElementById("demo");
6

ERROR: 'document' is not defined. [no-undef] document.getElementById("demo").innerHTML = random



Things to note:
-File location of JS and CSS are in the exam same folder.
-I never really learnt to write external JS so I don't understand differences between internal and external but what works internally doesn't seem to work externally and it's very frustrating.






 document.getElementById("button").onclick = function(){myFunction();

function myFunction() {
var random = Math.floor((Math.random() * 78) + 1);
document.getElementById("demo").innerHTML = random;
} // error is stated here

<!DOCTYPE html>
<html>
<head>
<script type = "text/javascript" src = "script.js"></script>
<link rel= "stylesheet" type = "text/css" href ="mystyle.css">
</head>
<body>
<Table>
<tr>
<td class = "bingocell" id = 1>1</td>
<td class = "bingocell" id = 2>2</td>
<td class = "bingocell" id = 3>3</td>
<td class = "bingocell" id = 4>4</td>
<td class = "bingocell" id = 5>5</td>
</tr>
<tr>
<td class = "bingocell" id = 6>1</td>
<td class = "bingocell" id = 7>2</td>
<td class = "bingocell" id = 8>3</td>
<td class = "bingocell" id = 9>4</td>
<td class = "bingocell" id = 10>5</td>
</tr>
<tr>
<td class = "bingocell" id = 11>1</td>
<td class = "bingocell" id = 12>2</td>
<td class = "bingocell" id = 13>3</td>
<td class = "bingocell" id = 14>4</td>
<td class = "bingocell" id = 15>5</td>
</tr>
<tr>
<td class = "bingocell" id = 16>1</td>
<td class = "bingocell" id = 17>2</td>
<td class = "bingocell" id = 18>3</td>
<td class = "bingocell" id = 19>4</td>
<td class = "bingocell" id = 20>5</td>
</tr>
<tr>
<td class = "bingocell" id = 21>1</td>
<td class = "bingocell" id = 22>2</td>
<td class = "bingocell" id = 23>3</td>
<td class = "bingocell" id = 24>4</td>
<td class = "bingocell" id = 25>5</td>
</tr>

</Table>

<p>Click the button to display a random number between 1 and 78.</p>

<button id = "button" onclick = "myFunction()">Try it</button>

<p id="demo"></p>



</body>
</html>





 document.getElementById("button").onclick = function(){myFunction();

function myFunction() {
var random = Math.floor((Math.random() * 78) + 1);
document.getElementById("demo").innerHTML = random;
} // error is stated here

<!DOCTYPE html>
<html>
<head>
<script type = "text/javascript" src = "script.js"></script>
<link rel= "stylesheet" type = "text/css" href ="mystyle.css">
</head>
<body>
<Table>
<tr>
<td class = "bingocell" id = 1>1</td>
<td class = "bingocell" id = 2>2</td>
<td class = "bingocell" id = 3>3</td>
<td class = "bingocell" id = 4>4</td>
<td class = "bingocell" id = 5>5</td>
</tr>
<tr>
<td class = "bingocell" id = 6>1</td>
<td class = "bingocell" id = 7>2</td>
<td class = "bingocell" id = 8>3</td>
<td class = "bingocell" id = 9>4</td>
<td class = "bingocell" id = 10>5</td>
</tr>
<tr>
<td class = "bingocell" id = 11>1</td>
<td class = "bingocell" id = 12>2</td>
<td class = "bingocell" id = 13>3</td>
<td class = "bingocell" id = 14>4</td>
<td class = "bingocell" id = 15>5</td>
</tr>
<tr>
<td class = "bingocell" id = 16>1</td>
<td class = "bingocell" id = 17>2</td>
<td class = "bingocell" id = 18>3</td>
<td class = "bingocell" id = 19>4</td>
<td class = "bingocell" id = 20>5</td>
</tr>
<tr>
<td class = "bingocell" id = 21>1</td>
<td class = "bingocell" id = 22>2</td>
<td class = "bingocell" id = 23>3</td>
<td class = "bingocell" id = 24>4</td>
<td class = "bingocell" id = 25>5</td>
</tr>

</Table>

<p>Click the button to display a random number between 1 and 78.</p>

<button id = "button" onclick = "myFunction()">Try it</button>

<p id="demo"></p>



</body>
</html>






javascript






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 4:31

























asked Nov 8 at 4:00









user10493657

12




12












  • Welcome to StackOverflow! Can you also provide the HTML for the code, and also more details regarding the exact error message?
    – Andreas
    Nov 8 at 4:02










  • } is missing at the end of function(){myFunction();
    – rv7
    Nov 8 at 4:03










  • Edit your question to add the HTML, don't add it in a comment.
    – RobG
    Nov 8 at 4:24


















  • Welcome to StackOverflow! Can you also provide the HTML for the code, and also more details regarding the exact error message?
    – Andreas
    Nov 8 at 4:02










  • } is missing at the end of function(){myFunction();
    – rv7
    Nov 8 at 4:03










  • Edit your question to add the HTML, don't add it in a comment.
    – RobG
    Nov 8 at 4:24
















Welcome to StackOverflow! Can you also provide the HTML for the code, and also more details regarding the exact error message?
– Andreas
Nov 8 at 4:02




Welcome to StackOverflow! Can you also provide the HTML for the code, and also more details regarding the exact error message?
– Andreas
Nov 8 at 4:02












} is missing at the end of function(){myFunction();
– rv7
Nov 8 at 4:03




} is missing at the end of function(){myFunction();
– rv7
Nov 8 at 4:03












Edit your question to add the HTML, don't add it in a comment.
– RobG
Nov 8 at 4:24




Edit your question to add the HTML, don't add it in a comment.
– RobG
Nov 8 at 4:24












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Problem solved
Did 2 things:
1) moved the "


2) This part is a bit embarrassing but I think I should leave it here as a reminder. Copied the JS file, from a JS folder and have only been editing the one still within the JS folder but the one on the same folder has not been edited.



Thanks for the help guys!






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53201376%2fjavascript-parsing-error-tokendetails-are-as-follows%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Problem solved
    Did 2 things:
    1) moved the "


    2) This part is a bit embarrassing but I think I should leave it here as a reminder. Copied the JS file, from a JS folder and have only been editing the one still within the JS folder but the one on the same folder has not been edited.



    Thanks for the help guys!






    share|improve this answer

























      up vote
      0
      down vote













      Problem solved
      Did 2 things:
      1) moved the "


      2) This part is a bit embarrassing but I think I should leave it here as a reminder. Copied the JS file, from a JS folder and have only been editing the one still within the JS folder but the one on the same folder has not been edited.



      Thanks for the help guys!






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Problem solved
        Did 2 things:
        1) moved the "


        2) This part is a bit embarrassing but I think I should leave it here as a reminder. Copied the JS file, from a JS folder and have only been editing the one still within the JS folder but the one on the same folder has not been edited.



        Thanks for the help guys!






        share|improve this answer












        Problem solved
        Did 2 things:
        1) moved the "


        2) This part is a bit embarrassing but I think I should leave it here as a reminder. Copied the JS file, from a JS folder and have only been editing the one still within the JS folder but the one on the same folder has not been edited.



        Thanks for the help guys!







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 8 at 4:43









        user10493657

        12




        12






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53201376%2fjavascript-parsing-error-tokendetails-are-as-follows%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud

            Zucchini