D

유트브영상 순간검색 구현

· 14년 전 · 2245 · 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,844
14년 전 조회 947
14년 전 조회 1,166
14년 전 조회 1,221
14년 전 조회 1,584
14년 전 조회 1,189
14년 전 조회 1,492
14년 전 조회 3,414
14년 전 조회 1,802
14년 전 조회 1,196
14년 전 조회 1,970
14년 전 조회 1,355
14년 전 조회 876
14년 전 조회 2,786
14년 전 조회 1,169
14년 전 조회 1,232
14년 전 조회 1,520
14년 전 조회 1,403
14년 전 조회 1,426
14년 전 조회 990
14년 전 조회 2,861
14년 전 조회 1,248
14년 전 조회 1,871
14년 전 조회 1,472
14년 전 조회 1,487
14년 전 조회 1,215
14년 전 조회 1,489
14년 전 조회 1,065
14년 전 조회 1,082
14년 전 조회 1,921
14년 전 조회 1,665
14년 전 조회 1,468
14년 전 조회 1,522
14년 전 조회 2,291
14년 전 조회 1,896
14년 전 조회 1,043
14년 전 조회 1,893
14년 전 조회 1,671
14년 전 조회 1,748
14년 전 조회 1,241
14년 전 조회 1,263
14년 전 조회 1,229
14년 전 조회 1,197
14년 전 조회 1,850
14년 전 조회 1,180
14년 전 조회 1,492
14년 전 조회 1,747
14년 전 조회 1,816
14년 전 조회 1,485
14년 전 조회 2,246
14년 전 조회 1,586
14년 전 조회 2,209
14년 전 조회 1,758
14년 전 조회 1,422
14년 전 조회 3,494
14년 전 조회 1,962
14년 전 조회 1,407
14년 전 조회 1,279
14년 전 조회 1,951
14년 전 조회 1,350
14년 전 조회 1,152
14년 전 조회 1,095
14년 전 조회 2,337
14년 전 조회 1,016
14년 전 조회 1,239
14년 전 조회 2,009
14년 전 조회 1,335
14년 전 조회 1,340
14년 전 조회 1,863
14년 전 조회 1,553
14년 전 조회 1,611
14년 전 조회 1,400
14년 전 조회 2,699
14년 전 조회 1,499
14년 전 조회 1,173
14년 전 조회 1,401
14년 전 조회 1,163
14년 전 조회 1,198
14년 전 조회 1,026
14년 전 조회 1,221
14년 전 조회 1,603
14년 전 조회 1,841
14년 전 조회 1,357
14년 전 조회 1,477
14년 전 조회 1,328
14년 전 조회 1,509
14년 전 조회 1,794
14년 전 조회 1,558
14년 전 조회 1,789
14년 전 조회 1,524
14년 전 조회 1,459
14년 전 조회 1,472
14년 전 조회 1,453
14년 전 조회 1,971
14년 전 조회 1,920
14년 전 조회 1,710
14년 전 조회 1,820
14년 전 조회 2,062
14년 전 조회 1,060
14년 전 조회 1,512