How to open video in a popup window when click on a anchor tag?

I want to open a video in a popup window when I click on the anchor tag.
I have more than one anchor tags and on every tag when I click then respected video open in the popup.
How I open different video popup when I click on different anchor tags?
I don’t know much more JavaScript.
Please help me.

This is my Code–

HTML Code–

<div class="scheme-div">
<div class="light">
<a class="boxclose" class="boxclose" onclick="lightbox_close();"></a>
<video id="VisaChipCardVideo" width="600" controls>
<source src="" type="video/mp4">
<div class="fade" onClick="lightbox_close();"></div>
<a href="#" onclick="lightbox_open();">
<img src="required-files/images/Thumbnail/IndustrialVideos/shampoo manufacturing.jpg" class="img-responsive">
<div class="scheme-content">
<div class="scheme-name"><a href="#" onclick="lightbox_open();">Shampoo Making Process</a></div>


window.document.onkeydown = function(e) {
  if (!e) {
    e = event;
  if (e.keyCode == 27) {

function lightbox_open() {
  var lightBoxVideo = document.getElementsByClassName("VisaChipCardVideo");
  window.scrollTo(0, 0);
  document.getElementsByClassName('light').style.display = 'block';
  document.getElementsByClassName('fade').style.display = 'block';;

function lightbox_close() {
  var lightBoxVideo = document.getElementsByClassName("VisaChipCardVideo");
  document.getElementsByClassName('light').style.display = 'none';
  document.getElementsByClassName('fade').style.display = 'none';


.fade {
  display: none;
  position: fixed;
  top: 0%;
  left: 0%;
  width: 100%;
  height: 100%;
  background-color: black;
  z-index: 1001;
  -moz-opacity: 0.8;
  opacity: .80;
  filter: alpha(opacity=80);

.light {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: 600px;
  max-height: 360px;
  margin-left: -300px;
  margin-top: -180px;
  border: 2px solid #FFF;
  background: #FFF;
  z-index: 1002;
  overflow: visible;

.boxclose {
  float: right;
  cursor: pointer;
  color: #fff;
  border: 1px solid #AEAEAE;
  border-radius: 3px;
  background: #222222;
  font-size: 31px;
  font-weight: bold;
  display: inline-block;
  line-height: 0px;
  padding: 11px 3px;
  position: absolute;
  right: 2px;
  top: 2px;
  z-index: 1002;
  opacity: 0.9;

.boxclose:before {
  content: "×";

.fade:hover ~ .boxclose {

Okay… let’s clear up a little terminology here before we move forward.

Are you wanting to open a new window when you click on a link? That’s handled through HTML, via the target attribute. Specifically, target="_blank".

Are you trying to replace the content of your lightbox when you click on the link?
Modifying a <source> inside a <video> won’t work (W3 HTML Standard 5.3). Your <video> element should instead have a src attribute, which you should be modifying.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.