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

223
Vistas
Uncaught SyntaxError: Unexpected end of input for <script> </script>

I am using the following JavaScript / html to play in a video in Chrome.

The console logs "Uncaught SyntaxError: Unexpected end of input".

I don't see what I'm doing wrong. What is my mistake here?

Thank you!

<html>
    <head><meta name="viewport">
        <style>
            video
            {
                position: relative;
            }
        </style>
    </head>
    
    <body>

        <video ontouchstart="playPause()" controls="controls" poster="" video width="100%" height="auto" autoplay id="vid">
            <source id="somefileID" src="file:///d:/dev/videos/Das%20Krokodil-Lied.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
        </video>

        <script>
        function playPause(e) 
        {
            if (!document.getElementById("myVideo")) 
            {
                alert("Element does not exist. Let's create it.");
            }
            var myVideo = document.getElementById("vid");
            if (myVideo = null) 
            { 
                alert('video is null!');
            }
            else
            {
             if (myVideo.paused)
             {
                 myVideo.play();
             }
             else
             {
                 myVideo.pause();
             }
        }
        </script>

    </body>
</html>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You have a few issues:

  1. You missed the final brace from your code. Using good tabbing structure would help you see more easily where the brace was missing.
  2. You used assignment = instead of ==

Look for **** below:

function playPause(e) 
{
    if (!document.getElementById("myVideo")) 
    {
        alert("Element does not exist. Let's create it.");
    }
    var myVideo = document.getElementById("vid");
    if (myVideo == null) // **** You probably mean == ****
    { 
        alert('video is null!');
    }
    else
    {
        if (myVideo.paused)
        {
            myVideo.play();
        }
        else
        {
            myVideo.pause();
        }
    }

} // **** MISSING ****
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