Jump to content

tonynsx

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by tonynsx

  1. I’m a new user and new to JS, so please bear with me.

    I have 3 files in the same folder, main.html, test.html and script.js

    In my main.html, I have

    script src="script.js", and <p id = "test"></p>
    In my test.html, I have

    script src="script.js", and <p id = "tt"></p>
    In my script.js, I have a function:

     function test() {
     	document.getElementbyId("test").innerHTML = "this is in main.html"
     	document.getElementbyId("tt").innerHTML = "this is in test.html"
     {
    

    But, when I call the function with a button, only the main.html 

    with id “test” is updated with “this is in main.html”, how come the 

    with id “tt” in test.html is not updated with “this is in test.html”?

     

×
×
  • Create New...