play video on click javascript code example
Example 1: play iframe video onclick a link javascript
<iframe id="video1" width="450" height="280" src="http://www.youtube.com/embed/TJ2X4dFhAC0?enablejsapi" frameborder="0" allowtransparency="true" allowfullscreen></iframe>
<a href="#" id="playvideo">Play button</a>
<script>
$("#playvideo").click(function(){
$("#video1")[0].src += "?autoplay=1";
});
</script>
Example 2: javascript video player
<!DOCTYPE html>
<html lang="en">
<head>
<title> Easy Video Player - TutsPlus Example </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="content/global.css">
<script type="text/javascript" src="java/FWDEVPlayer.js"></script>
</head>
<body>
</body>
</html>