Skip to content

Instantly share code, notes, and snippets.

@cpoDesign
Last active April 3, 2016 20:43
Show Gist options
  • Save cpoDesign/7e5079f3b1e3b8d911474a2a5131a9b2 to your computer and use it in GitHub Desktop.
Save cpoDesign/7e5079f3b1e3b8d911474a2a5131a9b2 to your computer and use it in GitHub Desktop.
example of generating iframe
<html>
<body>
<button onclick="pgen(1)" >open 1 </button>
<div id="gen">
demo
</div>
<script src="https://code.jquery.com/jquery-1.12.2.min.js" integrity="sha256-lZFHibXzMHo3GGeehn1hudTAP3Sc0uKXBXAzHX1sjtk=" crossorigin="anonymous"></script>
<script>
function pgen(videoId) {
var link = "http://www.cpodesign.com"
var iframe = document.createElement('iframe');
iframe.frameBorder=0;
iframe.width="300px";
iframe.height="250px";
iframe.id="randomid";
iframe.setAttribute("src", link);
$('#gen').html(iframe);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment