Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

133
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda