D

유트브영상 순간검색 구현

· 14년 전 · 2432 · 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년 전 조회 2,012
14년 전 조회 1,120
14년 전 조회 1,355
14년 전 조회 1,407
14년 전 조회 1,769
14년 전 조회 1,370
14년 전 조회 1,671
14년 전 조회 3,611
14년 전 조회 1,994
14년 전 조회 1,387
14년 전 조회 2,146
14년 전 조회 1,534
14년 전 조회 1,051
14년 전 조회 2,977
14년 전 조회 1,371
14년 전 조회 1,421
14년 전 조회 1,719
14년 전 조회 1,594
14년 전 조회 1,612
14년 전 조회 1,165
14년 전 조회 3,020
14년 전 조회 1,431
14년 전 조회 2,053
14년 전 조회 1,641
14년 전 조회 1,632
14년 전 조회 1,396
14년 전 조회 1,676
14년 전 조회 1,241
14년 전 조회 1,247
14년 전 조회 2,095
14년 전 조회 1,829
14년 전 조회 1,660
14년 전 조회 1,669
14년 전 조회 2,489
14년 전 조회 2,079
14년 전 조회 1,203
14년 전 조회 2,055
14년 전 조회 1,840
14년 전 조회 1,905
14년 전 조회 1,436
14년 전 조회 1,470
14년 전 조회 1,436
14년 전 조회 1,395
14년 전 조회 2,029
14년 전 조회 1,368
14년 전 조회 1,663
14년 전 조회 1,934
14년 전 조회 2,014
14년 전 조회 1,700
14년 전 조회 2,433
14년 전 조회 1,772
14년 전 조회 2,411
14년 전 조회 1,981
14년 전 조회 1,624
14년 전 조회 3,704
14년 전 조회 2,169
14년 전 조회 1,629
14년 전 조회 1,475
14년 전 조회 2,160
14년 전 조회 1,562
14년 전 조회 1,359
14년 전 조회 1,295
14년 전 조회 2,546
14년 전 조회 1,196
14년 전 조회 1,426
14년 전 조회 2,221
14년 전 조회 1,544
14년 전 조회 1,525
14년 전 조회 2,084
14년 전 조회 1,745
14년 전 조회 1,823
14년 전 조회 1,616
14년 전 조회 2,908
14년 전 조회 1,704
14년 전 조회 1,376
14년 전 조회 1,607
14년 전 조회 1,358
14년 전 조회 1,383
14년 전 조회 1,229
14년 전 조회 1,430
14년 전 조회 1,809
14년 전 조회 2,060
14년 전 조회 1,549
14년 전 조회 1,692
14년 전 조회 1,528
14년 전 조회 1,714
14년 전 조회 1,969
14년 전 조회 1,747
14년 전 조회 1,976
14년 전 조회 1,728
14년 전 조회 1,659
14년 전 조회 1,688
14년 전 조회 1,661
14년 전 조회 2,178
14년 전 조회 2,114
14년 전 조회 1,921
14년 전 조회 2,039
14년 전 조회 2,259
14년 전 조회 1,244
14년 전 조회 1,705