D

유트브영상 순간검색 구현

· 14년 전 · 1866 · 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,463
14년 전 조회 582
14년 전 조회 782
14년 전 조회 839
14년 전 조회 1,197
14년 전 조회 812
14년 전 조회 1,101
14년 전 조회 3,043
14년 전 조회 1,415
14년 전 조회 800
14년 전 조회 1,598
14년 전 조회 967
14년 전 조회 505
14년 전 조회 2,392
14년 전 조회 785
14년 전 조회 845
14년 전 조회 1,155
14년 전 조회 1,027
14년 전 조회 1,065
14년 전 조회 595
14년 전 조회 2,471
14년 전 조회 883
14년 전 조회 1,501
14년 전 조회 1,178
14년 전 조회 1,186
14년 전 조회 889
14년 전 조회 1,184
14년 전 조회 753
14년 전 조회 780
14년 전 조회 1,602
14년 전 조회 1,356
14년 전 조회 1,169
14년 전 조회 1,215
14년 전 조회 1,941
14년 전 조회 1,519
14년 전 조회 626
14년 전 조회 1,511
14년 전 조회 1,289
14년 전 조회 1,369
14년 전 조회 847
14년 전 조회 888
14년 전 조회 843
14년 전 조회 827
14년 전 조회 1,453
14년 전 조회 788
14년 전 조회 1,088
14년 전 조회 1,360
14년 전 조회 1,417
14년 전 조회 1,098
14년 전 조회 1,867
14년 전 조회 1,184
14년 전 조회 1,832
14년 전 조회 1,386
14년 전 조회 1,032
14년 전 조회 3,111
14년 전 조회 1,560
14년 전 조회 1,030
14년 전 조회 878
14년 전 조회 1,566
14년 전 조회 982
14년 전 조회 788
14년 전 조회 710
14년 전 조회 1,957
14년 전 조회 617
14년 전 조회 858
14년 전 조회 1,620
14년 전 조회 962
14년 전 조회 942
14년 전 조회 1,493
14년 전 조회 1,163
14년 전 조회 1,238
14년 전 조회 1,031
14년 전 조회 2,331
14년 전 조회 1,115
14년 전 조회 848
14년 전 조회 1,019
14년 전 조회 776
14년 전 조회 808
14년 전 조회 636
14년 전 조회 848
14년 전 조회 1,223
14년 전 조회 1,451
14년 전 조회 922
14년 전 조회 1,075
14년 전 조회 927
14년 전 조회 1,110
14년 전 조회 1,384
14년 전 조회 1,152
14년 전 조회 1,352
14년 전 조회 1,125
14년 전 조회 1,055
14년 전 조회 1,087
14년 전 조회 1,032
14년 전 조회 1,566
14년 전 조회 1,510
14년 전 조회 1,315
14년 전 조회 1,417
14년 전 조회 1,653
14년 전 조회 647
14년 전 조회 1,099
🐛 버그신고