D

유트브영상 순간검색 구현

· 14년 전 · 2371 · 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,984
14년 전 조회 1,090
14년 전 조회 1,324
14년 전 조회 1,375
14년 전 조회 1,723
14년 전 조회 1,328
14년 전 조회 1,622
14년 전 조회 3,574
14년 전 조회 1,949
14년 전 조회 1,345
14년 전 조회 2,108
14년 전 조회 1,495
14년 전 조회 1,009
14년 전 조회 2,929
14년 전 조회 1,305
14년 전 조회 1,363
14년 전 조회 1,660
14년 전 조회 1,541
14년 전 조회 1,564
14년 전 조회 1,107
14년 전 조회 2,973
14년 전 조회 1,385
14년 전 조회 1,991
14년 전 조회 1,594
14년 전 조회 1,589
14년 전 조회 1,330
14년 전 조회 1,624
14년 전 조회 1,188
14년 전 조회 1,197
14년 전 조회 2,042
14년 전 조회 1,772
14년 전 조회 1,596
14년 전 조회 1,625
14년 전 조회 2,443
14년 전 조회 2,030
14년 전 조회 1,150
14년 전 조회 2,009
14년 전 조회 1,793
14년 전 조회 1,853
14년 전 조회 1,376
14년 전 조회 1,409
14년 전 조회 1,376
14년 전 조회 1,341
14년 전 조회 1,985
14년 전 조회 1,319
14년 전 조회 1,616
14년 전 조회 1,883
14년 전 조회 1,960
14년 전 조회 1,635
14년 전 조회 2,372
14년 전 조회 1,713
14년 전 조회 2,358
14년 전 조회 1,920
14년 전 조회 1,571
14년 전 조회 3,647
14년 전 조회 2,112
14년 전 조회 1,576
14년 전 조회 1,416
14년 전 조회 2,103
14년 전 조회 1,498
14년 전 조회 1,298
14년 전 조회 1,239
14년 전 조회 2,489
14년 전 조회 1,145
14년 전 조회 1,373
14년 전 조회 2,167
14년 전 조회 1,486
14년 전 조회 1,473
14년 전 조회 2,014
14년 전 조회 1,698
14년 전 조회 1,767
14년 전 조회 1,564
14년 전 조회 2,849
14년 전 조회 1,643
14년 전 조회 1,321
14년 전 조회 1,546
14년 전 조회 1,301
14년 전 조회 1,320
14년 전 조회 1,161
14년 전 조회 1,376
14년 전 조회 1,756
14년 전 조회 1,997
14년 전 조회 1,485
14년 전 조회 1,642
14년 전 조회 1,477
14년 전 조회 1,663
14년 전 조회 1,925
14년 전 조회 1,696
14년 전 조회 1,926
14년 전 조회 1,676
14년 전 조회 1,606
14년 전 조회 1,634
14년 전 조회 1,596
14년 전 조회 2,128
14년 전 조회 2,056
14년 전 조회 1,863
14년 전 조회 1,974
14년 전 조회 2,218
14년 전 조회 1,197
14년 전 조회 1,661