D

유트브영상 순간검색 구현

· 14년 전 · 2171 · 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,775
14년 전 조회 871
14년 전 조회 1,091
14년 전 조회 1,142
14년 전 조회 1,508
14년 전 조회 1,113
14년 전 조회 1,418
14년 전 조회 3,351
14년 전 조회 1,722
14년 전 조회 1,118
14년 전 조회 1,891
14년 전 조회 1,269
14년 전 조회 796
14년 전 조회 2,709
14년 전 조회 1,100
14년 전 조회 1,165
14년 전 조회 1,450
14년 전 조회 1,328
14년 전 조회 1,348
14년 전 조회 906
14년 전 조회 2,785
14년 전 조회 1,168
14년 전 조회 1,803
14년 전 조회 1,428
14년 전 조회 1,442
14년 전 조회 1,165
14년 전 조회 1,442
14년 전 조회 1,020
14년 전 조회 1,035
14년 전 조회 1,869
14년 전 조회 1,615
14년 전 조회 1,419
14년 전 조회 1,471
14년 전 조회 2,218
14년 전 조회 1,827
14년 전 조회 977
14년 전 조회 1,818
14년 전 조회 1,601
14년 전 조회 1,680
14년 전 조회 1,170
14년 전 조회 1,186
14년 전 조회 1,168
14년 전 조회 1,119
14년 전 조회 1,766
14년 전 조회 1,109
14년 전 조회 1,412
14년 전 조회 1,676
14년 전 조회 1,738
14년 전 조회 1,409
14년 전 조회 2,172
14년 전 조회 1,512
14년 전 조회 2,130
14년 전 조회 1,695
14년 전 조회 1,351
14년 전 조회 3,420
14년 전 조회 1,878
14년 전 조회 1,322
14년 전 조회 1,200
14년 전 조회 1,884
14년 전 조회 1,283
14년 전 조회 1,081
14년 전 조회 1,025
14년 전 조회 2,262
14년 전 조회 942
14년 전 조회 1,172
14년 전 조회 1,936
14년 전 조회 1,262
14년 전 조회 1,269
14년 전 조회 1,805
14년 전 조회 1,476
14년 전 조회 1,537
14년 전 조회 1,327
14년 전 조회 2,625
14년 전 조회 1,429
14년 전 조회 1,110
14년 전 조회 1,328
14년 전 조회 1,090
14년 전 조회 1,124
14년 전 조회 947
14년 전 조회 1,153
14년 전 조회 1,525
14년 전 조회 1,761
14년 전 조회 1,317
14년 전 조회 1,390
14년 전 조회 1,244
14년 전 조회 1,437
14년 전 조회 1,709
14년 전 조회 1,477
14년 전 조회 1,710
14년 전 조회 1,436
14년 전 조회 1,371
14년 전 조회 1,394
14년 전 조회 1,369
14년 전 조회 1,887
14년 전 조회 1,836
14년 전 조회 1,643
14년 전 조회 1,747
14년 전 조회 1,987
14년 전 조회 964
14년 전 조회 1,433