Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
Why my JavaScript isn’t working with my html 5?

I have 2 files, the first file name Web.htm and the second file name Web.js

Web.htm:

<!DOCTYPE html>
<html>
<head>
    <title>My website</title>
</head>
<body>
    <script src="Web.js"></script>
</body>
</html>

Web.js

alert('Hello, World');

I already put the two files in the same folder but when I run the Web.htm, there isn’t have any box that show up and say Hello, World

But when remove the src in the <script> in the html file like this

<script>
    alert('Hello, World');
</script>

It still working, so what happened with my JavaScript, did I need to host a website to make it work? I’m actually isn’t host it yet.

Sorry if this question is stupid, I’m actually a beginners of JavaScript.

Edit: I fix the scr to src but it still isn’t work.

Edit: I fix the problem, I installed and configure the HTTP server like esqew said in the comment and it work. Look like my computer isn’t installed the HTTP server yet, sorry you guy.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Seems like you have a typo.

try: <script src="Web.js"></script>

When you are using a JavaScript file, you should NOT use HTML tags:

change your web.js file from:

<script>
    alert('Hello, World');
</script>

to

alert('Hello, World');
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!