Dark_Delphin,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title> <meta charset="utf-8">
</head>
<body> <input id="xf_videoimg" name="">
<script>
var video_id = 12345;
var final1 = "<label class='control-label col-lg-2'>Превью картинка:</label><div class='col-lg-10'><input onclick='select(this);' type='text' class='edit bk' style='width:350px;' value='http://img.youtube.com/vi/"+video_id+"/mqdefault.jpg' readonly> <a href='javascript://' onclick=\"document.getElementById('xf_videoimg').value = 'http://img.youtube.com/vi/"+video_id+"/mqdefault.jpg'\">Вставить</a> </div>";
document.write(final1)
</script>
</body>
</html>