D

유트브영상 순간검색 구현

· 14년 전 · 1921 · 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,522
14년 전 조회 633
14년 전 조회 835
14년 전 조회 894
14년 전 조회 1,249
14년 전 조회 860
14년 전 조회 1,150
14년 전 조회 3,094
14년 전 조회 1,467
14년 전 조회 866
14년 전 조회 1,658
14년 전 조회 1,015
14년 전 조회 544
14년 전 조회 2,436
14년 전 조회 830
14년 전 조회 897
14년 전 조회 1,212
14년 전 조회 1,084
14년 전 조회 1,113
14년 전 조회 638
14년 전 조회 2,521
14년 전 조회 932
14년 전 조회 1,537
14년 전 조회 1,220
14년 전 조회 1,235
14년 전 조회 951
14년 전 조회 1,227
14년 전 조회 805
14년 전 조회 841
14년 전 조회 1,660
14년 전 조회 1,404
14년 전 조회 1,217
14년 전 조회 1,270
14년 전 조회 1,989
14년 전 조회 1,574
14년 전 조회 683
14년 전 조회 1,567
14년 전 조회 1,344
14년 전 조회 1,422
14년 전 조회 909
14년 전 조회 937
14년 전 조회 901
14년 전 조회 890
14년 전 조회 1,515
14년 전 조회 841
14년 전 조회 1,137
14년 전 조회 1,415
14년 전 조회 1,466
14년 전 조회 1,133
14년 전 조회 1,922
14년 전 조회 1,228
14년 전 조회 1,881
14년 전 조회 1,443
14년 전 조회 1,084
14년 전 조회 3,159
14년 전 조회 1,612
14년 전 조회 1,072
14년 전 조회 927
14년 전 조회 1,617
14년 전 조회 1,035
14년 전 조회 830
14년 전 조회 765
14년 전 조회 2,004
14년 전 조회 669
14년 전 조회 908
14년 전 조회 1,671
14년 전 조회 1,007
14년 전 조회 999
14년 전 조회 1,536
14년 전 조회 1,216
14년 전 조회 1,280
14년 전 조회 1,086
14년 전 조회 2,382
14년 전 조회 1,177
14년 전 조회 876
14년 전 조회 1,063
14년 전 조회 816
14년 전 조회 852
14년 전 조회 679
14년 전 조회 889
14년 전 조회 1,276
14년 전 조회 1,494
14년 전 조회 963
14년 전 조회 1,129
14년 전 조회 975
14년 전 조회 1,166
14년 전 조회 1,431
14년 전 조회 1,196
14년 전 조회 1,399
14년 전 조회 1,169
14년 전 조회 1,109
14년 전 조회 1,125
14년 전 조회 1,074
14년 전 조회 1,614
14년 전 조회 1,559
14년 전 조회 1,361
14년 전 조회 1,462
14년 전 조회 1,696
14년 전 조회 691
14년 전 조회 1,151