D

유트브영상 순간검색 구현

· 14년 전 · 1923 · 9
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="history" content="">
<meta name="author" content="dokjin@gamil.com">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<title>유트브 순간검색</title>
<script type="text/javascript">
$(document).ready(function()
{

$(".search_input").keyup(function()
{
var search_input = $(this).val();
var keyword= encodeURIComponent(search_input);
var yt_url='http://gdata.youtube.com/feeds/api/videos?q='+keyword+'&format=5&max-results=1&v=2&alt=jsonc';
$.ajax
({
type: "GET",
url: yt_url,
dataType:"jsonp",
success: function(response)
{
if(response.data.items)
{
$.each(response.data.items, function(i,data)
{
var video_id=data.id;
var video_title=data.title;
var video_viewCount=data.viewCount;
var video_frame="<iframe width='640' height='385' src='http://www.youtube.com/embed/"+video_id+"' frameborder='0' type='text/html'></iframe>";
var final="<div id='title'>"+video_title+"</div><div>"+video_frame+"</div><div id='count'>"+video_viewCount+" Views</div>";
$("#result").html(final); // Result
});
}
else
{
$("#result").html("<div id='no'>No Video</div>");
}
}
});
});
});
function yts(search_input){
var keyword= encodeURIComponent(search_input);
var yt_url='http://gdata.youtube.com/feeds/api/videos?q='+keyword+'&format=5&max-results=1&v=2&alt=jsonc';
$.ajax
({
type: "GET",
url: yt_url,
dataType:"jsonp",
success: function(response)
{
if(response.data.items)
{
$.each(response.data.items, function(i,data)
{
var video_id=data.id;
var video_title=data.title;
var video_viewCount=data.viewCount;
var video_frame="<iframe width='640' height='385' src='http://www.youtube.com/embed/"+video_id+"' frameborder='0' type='text/html'></iframe>";
var final="<div id='title'>"+video_title+"</div><div>"+video_frame+"</div><div id='count'>오늘까지뷰 "+video_viewCount+" Views</div>";
$("#result").html(final); // Result
});
}
else
{
$("#result").html("<div id='no'>No Video</div>");
}
}
});
}
yts('Empire State of Mind');
</script>
</head>
<body>
<div id="wrap">
<h2>DOKJIN PLAY GROUND</h2>
<div id="result"></div>
<h2>검색어를 입력하세요 <input type="text" class='search_input' /> </h2>
<br />
<h2><a href="#" onclick="yts('아이유');">onclick="yts('아이유');"</a></h2>
<ul>
</div>
</body>
</html><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]</div>

첨부파일

youtube.html (2.7 KB) 86회 2011-07-13 13:31
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
14년 전 조회 1,525
14년 전 조회 634
14년 전 조회 835
14년 전 조회 895
14년 전 조회 1,249
14년 전 조회 861
14년 전 조회 1,150
14년 전 조회 3,096
14년 전 조회 1,469
14년 전 조회 867
14년 전 조회 1,659
14년 전 조회 1,016
14년 전 조회 546
14년 전 조회 2,437
14년 전 조회 831
14년 전 조회 898
14년 전 조회 1,214
14년 전 조회 1,087
14년 전 조회 1,114
14년 전 조회 640
14년 전 조회 2,522
14년 전 조회 934
14년 전 조회 1,539
14년 전 조회 1,220
14년 전 조회 1,235
14년 전 조회 951
14년 전 조회 1,227
14년 전 조회 806
14년 전 조회 841
14년 전 조회 1,660
14년 전 조회 1,406
14년 전 조회 1,221
14년 전 조회 1,271
14년 전 조회 1,993
14년 전 조회 1,575
14년 전 조회 686
14년 전 조회 1,569
14년 전 조회 1,347
14년 전 조회 1,426
14년 전 조회 911
14년 전 조회 939
14년 전 조회 901
14년 전 조회 890
14년 전 조회 1,517
14년 전 조회 842
14년 전 조회 1,141
14년 전 조회 1,417
14년 전 조회 1,469
14년 전 조회 1,137
14년 전 조회 1,924
14년 전 조회 1,230
14년 전 조회 1,885
14년 전 조회 1,444
14년 전 조회 1,084
14년 전 조회 3,160
14년 전 조회 1,614
14년 전 조회 1,073
14년 전 조회 927
14년 전 조회 1,620
14년 전 조회 1,038
14년 전 조회 832
14년 전 조회 768
14년 전 조회 2,009
14년 전 조회 673
14년 전 조회 912
14년 전 조회 1,675
14년 전 조회 1,009
14년 전 조회 1,001
14년 전 조회 1,540
14년 전 조회 1,220
14년 전 조회 1,283
14년 전 조회 1,089
14년 전 조회 2,383
14년 전 조회 1,178
14년 전 조회 878
14년 전 조회 1,064
14년 전 조회 818
14년 전 조회 853
14년 전 조회 680
14년 전 조회 890
14년 전 조회 1,276
14년 전 조회 1,496
14년 전 조회 965
14년 전 조회 1,129
14년 전 조회 979
14년 전 조회 1,166
14년 전 조회 1,433
14년 전 조회 1,198
14년 전 조회 1,400
14년 전 조회 1,171
14년 전 조회 1,111
14년 전 조회 1,126
14년 전 조회 1,076
14년 전 조회 1,615
14년 전 조회 1,559
14년 전 조회 1,363
14년 전 조회 1,465
14년 전 조회 1,698
14년 전 조회 692
14년 전 조회 1,151