D

유트브영상 순간검색 구현

· 14년 전 · 1861 · 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,459
14년 전 조회 577
14년 전 조회 775
14년 전 조회 834
14년 전 조회 1,191
14년 전 조회 807
14년 전 조회 1,094
14년 전 조회 3,036
14년 전 조회 1,409
14년 전 조회 793
14년 전 조회 1,593
14년 전 조회 959
14년 전 조회 498
14년 전 조회 2,384
14년 전 조회 783
14년 전 조회 841
14년 전 조회 1,150
14년 전 조회 1,022
14년 전 조회 1,058
14년 전 조회 590
14년 전 조회 2,463
14년 전 조회 881
14년 전 조회 1,495
14년 전 조회 1,173
14년 전 조회 1,180
14년 전 조회 880
14년 전 조회 1,175
14년 전 조회 748
14년 전 조회 775
14년 전 조회 1,594
14년 전 조회 1,351
14년 전 조회 1,166
14년 전 조회 1,211
14년 전 조회 1,937
14년 전 조회 1,513
14년 전 조회 621
14년 전 조회 1,505
14년 전 조회 1,281
14년 전 조회 1,366
14년 전 조회 845
14년 전 조회 883
14년 전 조회 837
14년 전 조회 822
14년 전 조회 1,447
14년 전 조회 785
14년 전 조회 1,081
14년 전 조회 1,356
14년 전 조회 1,411
14년 전 조회 1,092
14년 전 조회 1,862
14년 전 조회 1,179
14년 전 조회 1,828
14년 전 조회 1,381
14년 전 조회 1,028
14년 전 조회 3,103
14년 전 조회 1,552
14년 전 조회 1,025
14년 전 조회 874
14년 전 조회 1,562
14년 전 조회 978
14년 전 조회 783
14년 전 조회 703
14년 전 조회 1,950
14년 전 조회 610
14년 전 조회 853
14년 전 조회 1,615
14년 전 조회 956
14년 전 조회 937
14년 전 조회 1,486
14년 전 조회 1,159
14년 전 조회 1,232
14년 전 조회 1,025
14년 전 조회 2,322
14년 전 조회 1,109
14년 전 조회 840
14년 전 조회 1,014
14년 전 조회 775
14년 전 조회 804
14년 전 조회 629
14년 전 조회 842
14년 전 조회 1,218
14년 전 조회 1,448
14년 전 조회 916
14년 전 조회 1,070
14년 전 조회 924
14년 전 조회 1,106
14년 전 조회 1,376
14년 전 조회 1,148
14년 전 조회 1,345
14년 전 조회 1,121
14년 전 조회 1,050
14년 전 조회 1,081
14년 전 조회 1,027
14년 전 조회 1,556
14년 전 조회 1,504
14년 전 조회 1,310
14년 전 조회 1,412
14년 전 조회 1,650
14년 전 조회 644
14년 전 조회 1,092
🐛 버그신고