D

유트브영상 순간검색 구현

· 14년 전 · 2163 · 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,763
14년 전 조회 863
14년 전 조회 1,081
14년 전 조회 1,132
14년 전 조회 1,496
14년 전 조회 1,106
14년 전 조회 1,406
14년 전 조회 3,341
14년 전 조회 1,716
14년 전 조회 1,107
14년 전 조회 1,883
14년 전 조회 1,260
14년 전 조회 784
14년 전 조회 2,695
14년 전 조회 1,090
14년 전 조회 1,158
14년 전 조회 1,439
14년 전 조회 1,321
14년 전 조회 1,344
14년 전 조회 893
14년 전 조회 2,777
14년 전 조회 1,157
14년 전 조회 1,791
14년 전 조회 1,421
14년 전 조회 1,433
14년 전 조회 1,157
14년 전 조회 1,432
14년 전 조회 1,010
14년 전 조회 1,024
14년 전 조회 1,855
14년 전 조회 1,605
14년 전 조회 1,411
14년 전 조회 1,464
14년 전 조회 2,211
14년 전 조회 1,815
14년 전 조회 966
14년 전 조회 1,806
14년 전 조회 1,591
14년 전 조회 1,668
14년 전 조회 1,158
14년 전 조회 1,177
14년 전 조회 1,155
14년 전 조회 1,108
14년 전 조회 1,757
14년 전 조회 1,097
14년 전 조회 1,397
14년 전 조회 1,664
14년 전 조회 1,724
14년 전 조회 1,400
14년 전 조회 2,164
14년 전 조회 1,501
14년 전 조회 2,120
14년 전 조회 1,686
14년 전 조회 1,339
14년 전 조회 3,412
14년 전 조회 1,870
14년 전 조회 1,313
14년 전 조회 1,186
14년 전 조회 1,878
14년 전 조회 1,276
14년 전 조회 1,073
14년 전 조회 1,013
14년 전 조회 2,252
14년 전 조회 933
14년 전 조회 1,160
14년 전 조회 1,927
14년 전 조회 1,257
14년 전 조회 1,256
14년 전 조회 1,794
14년 전 조회 1,465
14년 전 조회 1,530
14년 전 조회 1,314
14년 전 조회 2,618
14년 전 조회 1,415
14년 전 조회 1,103
14년 전 조회 1,321
14년 전 조회 1,074
14년 전 조회 1,116
14년 전 조회 941
14년 전 조회 1,142
14년 전 조회 1,522
14년 전 조회 1,754
14년 전 조회 1,306
14년 전 조회 1,383
14년 전 조회 1,236
14년 전 조회 1,430
14년 전 조회 1,698
14년 전 조회 1,472
14년 전 조회 1,699
14년 전 조회 1,427
14년 전 조회 1,364
14년 전 조회 1,381
14년 전 조회 1,362
14년 전 조회 1,879
14년 전 조회 1,825
14년 전 조회 1,630
14년 전 조회 1,731
14년 전 조회 1,969
14년 전 조회 952
14년 전 조회 1,423