Calling a local javascript file in html



I am brand new to atom and web development.

I want to build a really simple webpage that calls a simple javascript function, saved in an external file.

Here is my html code:

<script language="javascript"

Make this

test code

Try it

and here is my javascript code

Both scripts are in the same directory. I tried putting the full directory in the function but it still didnt call it. How do I get the html code to call javascript?


Could not figure out how to put my code in here without it actually running the code so here it is as a picture…


You should pay attention to the highlighting. The tags that aren’t highlighting properly will point you to where you’re missing a > at the end of your first <script> tag. I’m confused about what you are attempting to do with a <script> tag inside <title>. You should also have <body> tags surrounding everything that follows <head>.

Highlight the code and press the </> button above the editor.


In general, markdown recognises code when it’s between a set of three or more backticks (`). In most renderers, an additional name on the same line as the first backticks will tell it the language to select for highlighting. I don’t think this forum does that though, so it’s kind of optional here.


// code goes here

for JavaScript code

To get the backticks in that code block, I simply used 4 backticks as the delimiters, so my raw source actually looked like the following

// code goes here

It’s important to do this when sharing code, as it preserves indentation and does not attempt to read the HTML tags (which are also valid in markdown).

There is also an indentation method, but you can just look at the GFM markdown specs to see what’s allowed.


Discourse does respect language tags.

 I specified \LaTeX, but it's highlighting like it's coffeescript
 I specified \LaTeX, but it's highlighting like it's coffeescript

The support seems kind of patchy though…


Maybe not all of them. Oh well. I know that it does for CSS, JS, CS, HTML, Python, and Ruby, at least.