var win = window.open("", "win", "width=500,height=600"); // a window object
win.document.open("text/html", "replace");
win.document.write('<iframe width="420" height="315" src="http://www.youtube.com/embed/bKkESJ1abRA" frameborder="0" allowfullscreen></iframe><p>Your text</p><p>Hey, moar text :D</p>');
win.document.close();
win.focus();
尝试这个!
在评论中提出您的要求后:
<html>
<head>
<script>
function openWindow(url,id){
var win = window.open("", "win", "width=500,height=600"); // a window object
var myText = document.getElementById(id).innerHTML;
win.document.open("text/html", "replace");
win.document.write('<iframe width="420" height="315" src="'+url+'" frameborder="0" allowfullscreen></iframe>'+myText);
win.document.close();
}
</script>
</head>
<body>
<img src="asd.jpg" onclick="openWindow('http://www.youtube.com/embed/bKkESJ1abRA','div1')">
<img src="dsa.jpg" onclick="openWindow('http://www.youtube.com/embed/bKkESJ1abRA','div2')">
<div style="display: none" id="div1">
<p>My text 1</p>
</div>
<div style="display: none" id="div2">
<p>My text 2</p>
</div>
</body>
</html>
小提琴:http: //jsfiddle.net/BRAQD/