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

354
Vistas
can you add src and play in js and html

This is not working for me. I created script src to my HTML

function eyob1() {   
    var play1 = document.getElementById("aud").src="eyobmknn/trk1.mp3"
    play1.loop = "true";
    pley1.play();
}
<!DOCTYPE html>
<html >
<head >
<link rel="stylesheet" href="launch.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body>
    <div onclick="openeyob();" class="eyob" id="eyob">Eyob Mekonnen</div>
    <div id="container">
    <div onclick="eyob1();" class="eyob1" id="eyob">01 track 01 

    <script  src="lunch.js"></script>
</body>
</html>

and I can add src but the sound cannot be played

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I answared a similar question here: How to play audio loaded via file input

It's possible to change the src attribute using the method SetAtrribute:

function eyob1() {   
    var play1 = document.getElementById("aud")
    play1.settAtribute('src', "eyobmknn/trk1.mp3")
}

But is important to notice that your code does't have a an element with id='audio'. Your script won't work as it is now.

A good start point is here: https://developer.mozilla.org/en-US/docs/Web/Tutorials

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