This is a basic question but Google did not help.
I have a website and what to do to run javascript on it.
In my directory I have index.html, and index.css. For the javascript file, I am assuming that it should be called index.js.
I have this in my index.js file:
var countTime = 0; // Number of seconds var redirectURL = "http://example.com"; // countTime = (countTime + 1) * URL for direct to 1000; Function UpdateCount () {countTime = countTime-1000; If (document.getElementById ("Countdown Performance")) document.getElementById ("Countdown Performance"). InnerHTML = (countTime / 1000); If (countTime & lt; = 0) location.href = redirectURL; Else setTimeout ("updateCount ()", 1000); } UpdateCount (); However, when I go from page to browser, it does not work. Do I have to do something in my HTML file like index.js or something?
& lt; Script src = "index.js" type = "text / javascript" & gt; & Lt; / Script & gt; Your & lt; Head & gt; . This will load the script for you and then the code will be executed.
Yours too
& lt; Div id = "countdownDisplay" & gt; & Lt; / Div & gt; In your & lt; & lt; Style src = "index.css" / P>
Comments
Post a Comment