Youtube video popup

0

I created a link in an image so when clicking the image opens a popup centered on the screen with the video of youtube, it is working but what I did not know if it would be correct because phpstorm says that there is an error, but this one can someone help me?

Link = >

<a <label onclick="PopupCenter('https://www.youtube.com/embed/INQcOCgpOXs','785','680')"
        style="cursor:pointer;"></label>
    <img style="margin-right: -4.5px; border:solid 1px #ffffff" class="espaco"  src="imagens/thumb/atomizador_250lts_25_thumb.png" alt="" />
</a>

Popup script = >

<script type="text/javascript"> function PopupCenter(pageURL, title, w, h) {
    var left = (screen.width / 2) - (w / 2);
    var top = (screen.height / 2) - (h / 2);
    var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=650px' + w + ', height=450px' + h + ', top=100%' + ', left=' + left);
}
</script>
    
asked by anonymous 12.09.2017 / 18:41

2 answers

2

I think the error that PHPStorm is pointing to is about the link because it does not make sense for the <label> tag inside <a> as it is:

<a <label onclick="PopupCenter('https://www.youtube.com/embed/INQcOCgpOXs','785','680')"
    style="cursor:pointer;"></label><img></a>

The correct thing would be to remove the label tag, and put its content in <a> itself. I also noticed that when calling the function PopupCenter() in the <a> tag, you are not passing the title as an argument, the final code would look like this:

<a onclick="PopupCenter('https://www.youtube.com/embed/INQcOCgpOXs','Titulo do Vídeo','785','680')" style="cursor:pointer;"><img style="margin-right: -4.5px; border:solid 1px #ffffff" class="espaco"  src="imagens/thumb/atomizador_250lts_25_thumb.png" alt="" /></a>
    
12.09.2017 / 19:00
1

I do not know if it can be this but at the beginning you are creating a tag inside another:

<a <label onclick = "PopupCenter('https://www.youtube.com/embed/INQcOCgpOXs','785','680')" style="cursor:pointer;"></label>

I believe that I would need to create label within a :

<a>
    <label onclick = "PopupCenter('https://www.youtube.com/embed/INQcOCgpOXs','785','680')" style = "cursor:pointer;"></label>
    <img style="margin-right: -4.5px; border:solid 1px #ffffff" class="espaco"  src="imagens/thumb/atomizador_250lts_25_thumb.png" alt="" />
</a>
    
12.09.2017 / 18:45