D

유트브영상 순간검색 구현

· 14년 전 · 1956 · 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,551
14년 전 조회 665
14년 전 조회 865
14년 전 조회 926
14년 전 조회 1,278
14년 전 조회 893
14년 전 조회 1,179
14년 전 조회 3,133
14년 전 조회 1,506
14년 전 조회 905
14년 전 조회 1,683
14년 전 조회 1,051
14년 전 조회 590
14년 전 조회 2,478
14년 전 조회 873
14년 전 조회 935
14년 전 조회 1,244
14년 전 조회 1,121
14년 전 조회 1,152
14년 전 조회 675
14년 전 조회 2,561
14년 전 조회 966
14년 전 조회 1,582
14년 전 조회 1,253
14년 전 조회 1,273
14년 전 조회 982
14년 전 조회 1,263
14년 전 조회 840
14년 전 조회 874
14년 전 조회 1,689
14년 전 조회 1,453
14년 전 조회 1,255
14년 전 조회 1,318
14년 전 조회 2,025
14년 전 조회 1,611
14년 전 조회 717
14년 전 조회 1,604
14년 전 조회 1,382
14년 전 조회 1,455
14년 전 조회 950
14년 전 조회 970
14년 전 조회 938
14년 전 조회 930
14년 전 조회 1,554
14년 전 조회 878
14년 전 조회 1,176
14년 전 조회 1,453
14년 전 조회 1,510
14년 전 조회 1,177
14년 전 조회 1,957
14년 전 조회 1,267
14년 전 조회 1,935
14년 전 조회 1,485
14년 전 조회 1,122
14년 전 조회 3,200
14년 전 조회 1,650
14년 전 조회 1,110
14년 전 조회 959
14년 전 조회 1,666
14년 전 조회 1,074
14년 전 조회 860
14년 전 조회 810
14년 전 조회 2,046
14년 전 조회 711
14년 전 조회 949
14년 전 조회 1,718
14년 전 조회 1,046
14년 전 조회 1,030
14년 전 조회 1,573
14년 전 조회 1,256
14년 전 조회 1,320
14년 전 조회 1,119
14년 전 조회 2,417
14년 전 조회 1,207
14년 전 조회 916
14년 전 조회 1,100
14년 전 조회 865
14년 전 조회 898
14년 전 조회 720
14년 전 조회 937
14년 전 조회 1,319
14년 전 조회 1,540
14년 전 조회 998
14년 전 조회 1,166
14년 전 조회 1,008
14년 전 조회 1,199
14년 전 조회 1,469
14년 전 조회 1,242
14년 전 조회 1,445
14년 전 조회 1,205
14년 전 조회 1,145
14년 전 조회 1,169
14년 전 조회 1,112
14년 전 조회 1,655
14년 전 조회 1,602
14년 전 조회 1,412
14년 전 조회 1,495
14년 전 조회 1,747
14년 전 조회 728
14년 전 조회 1,187