D

유트브영상 순간검색 구현

· 14년 전 · 1886 · 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,490
14년 전 조회 606
14년 전 조회 813
14년 전 조회 866
14년 전 조회 1,229
14년 전 조회 841
14년 전 조회 1,121
14년 전 조회 3,071
14년 전 조회 1,437
14년 전 조회 839
14년 전 조회 1,626
14년 전 조회 991
14년 전 조회 522
14년 전 조회 2,414
14년 전 조회 811
14년 전 조회 872
14년 전 조회 1,176
14년 전 조회 1,055
14년 전 조회 1,090
14년 전 조회 618
14년 전 조회 2,501
14년 전 조회 906
14년 전 조회 1,523
14년 전 조회 1,200
14년 전 조회 1,213
14년 전 조회 922
14년 전 조회 1,205
14년 전 조회 779
14년 전 조회 799
14년 전 조회 1,636
14년 전 조회 1,385
14년 전 조회 1,196
14년 전 조회 1,244
14년 전 조회 1,968
14년 전 조회 1,547
14년 전 조회 652
14년 전 조회 1,537
14년 전 조회 1,308
14년 전 조회 1,396
14년 전 조회 879
14년 전 조회 908
14년 전 조회 873
14년 전 조회 861
14년 전 조회 1,479
14년 전 조회 811
14년 전 조회 1,109
14년 전 조회 1,387
14년 전 조회 1,438
14년 전 조회 1,113
14년 전 조회 1,886
14년 전 조회 1,205
14년 전 조회 1,859
14년 전 조회 1,414
14년 전 조회 1,057
14년 전 조회 3,132
14년 전 조회 1,591
14년 전 조회 1,053
14년 전 조회 907
14년 전 조회 1,587
14년 전 조회 1,009
14년 전 조회 808
14년 전 조회 730
14년 전 조회 1,980
14년 전 조회 646
14년 전 조회 878
14년 전 조회 1,643
14년 전 조회 982
14년 전 조회 971
14년 전 조회 1,511
14년 전 조회 1,190
14년 전 조회 1,254
14년 전 조회 1,052
14년 전 조회 2,351
14년 전 조회 1,144
14년 전 조회 856
14년 전 조회 1,041
14년 전 조회 798
14년 전 조회 826
14년 전 조회 661
14년 전 조회 863
14년 전 조회 1,250
14년 전 조회 1,471
14년 전 조회 944
14년 전 조회 1,097
14년 전 조회 951
14년 전 조회 1,132
14년 전 조회 1,404
14년 전 조회 1,176
14년 전 조회 1,374
14년 전 조회 1,141
14년 전 조회 1,079
14년 전 조회 1,101
14년 전 조회 1,052
14년 전 조회 1,585
14년 전 조회 1,526
14년 전 조회 1,335
14년 전 조회 1,437
14년 전 조회 1,671
14년 전 조회 669
14년 전 조회 1,124