D

유트브영상 순간검색 구현

· 14년 전 · 1980 · 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,573
14년 전 조회 684
14년 전 조회 899
14년 전 조회 950
14년 전 조회 1,304
14년 전 조회 914
14년 전 조회 1,212
14년 전 조회 3,156
14년 전 조회 1,534
14년 전 조회 926
14년 전 조회 1,707
14년 전 조회 1,082
14년 전 조회 613
14년 전 조회 2,506
14년 전 조회 902
14년 전 조회 964
14년 전 조회 1,270
14년 전 조회 1,141
14년 전 조회 1,175
14년 전 조회 702
14년 전 조회 2,583
14년 전 조회 992
14년 전 조회 1,602
14년 전 조회 1,285
14년 전 조회 1,295
14년 전 조회 1,008
14년 전 조회 1,294
14년 전 조회 863
14년 전 조회 901
14년 전 조회 1,716
14년 전 조회 1,479
14년 전 조회 1,285
14년 전 조회 1,337
14년 전 조회 2,044
14년 전 조회 1,630
14년 전 조회 738
14년 전 조회 1,633
14년 전 조회 1,413
14년 전 조회 1,480
14년 전 조회 975
14년 전 조회 1,004
14년 전 조회 963
14년 전 조회 954
14년 전 조회 1,574
14년 전 조회 904
14년 전 조회 1,203
14년 전 조회 1,473
14년 전 조회 1,541
14년 전 조회 1,201
14년 전 조회 1,981
14년 전 조회 1,296
14년 전 조회 1,957
14년 전 조회 1,510
14년 전 조회 1,144
14년 전 조회 3,222
14년 전 조회 1,677
14년 전 조회 1,137
14년 전 조회 994
14년 전 조회 1,685
14년 전 조회 1,101
14년 전 조회 882
14년 전 조회 831
14년 전 조회 2,072
14년 전 조회 732
14년 전 조회 973
14년 전 조회 1,747
14년 전 조회 1,067
14년 전 조회 1,062
14년 전 조회 1,598
14년 전 조회 1,278
14년 전 조회 1,345
14년 전 조회 1,145
14년 전 조회 2,449
14년 전 조회 1,237
14년 전 조회 944
14년 전 조회 1,133
14년 전 조회 891
14년 전 조회 923
14년 전 조회 744
14년 전 조회 967
14년 전 조회 1,343
14년 전 조회 1,569
14년 전 조회 1,020
14년 전 조회 1,198
14년 전 조회 1,032
14년 전 조회 1,231
14년 전 조회 1,498
14년 전 조회 1,263
14년 전 조회 1,471
14년 전 조회 1,230
14년 전 조회 1,164
14년 전 조회 1,193
14년 전 조회 1,137
14년 전 조회 1,683
14년 전 조회 1,626
14년 전 조회 1,439
14년 전 조회 1,518
14년 전 조회 1,767
14년 전 조회 758
14년 전 조회 1,215