D

유트브영상 순간검색 구현

· 14년 전 · 2169 · 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,773
14년 전 조회 871
14년 전 조회 1,087
14년 전 조회 1,140
14년 전 조회 1,503
14년 전 조회 1,112
14년 전 조회 1,417
14년 전 조회 3,349
14년 전 조회 1,721
14년 전 조회 1,118
14년 전 조회 1,890
14년 전 조회 1,266
14년 전 조회 796
14년 전 조회 2,707
14년 전 조회 1,097
14년 전 조회 1,165
14년 전 조회 1,449
14년 전 조회 1,325
14년 전 조회 1,347
14년 전 조회 902
14년 전 조회 2,783
14년 전 조회 1,164
14년 전 조회 1,800
14년 전 조회 1,427
14년 전 조회 1,442
14년 전 조회 1,162
14년 전 조회 1,439
14년 전 조회 1,017
14년 전 조회 1,031
14년 전 조회 1,868
14년 전 조회 1,613
14년 전 조회 1,418
14년 전 조회 1,471
14년 전 조회 2,216
14년 전 조회 1,822
14년 전 조회 975
14년 전 조회 1,814
14년 전 조회 1,596
14년 전 조회 1,678
14년 전 조회 1,166
14년 전 조회 1,184
14년 전 조회 1,165
14년 전 조회 1,118
14년 전 조회 1,762
14년 전 조회 1,106
14년 전 조회 1,409
14년 전 조회 1,674
14년 전 조회 1,736
14년 전 조회 1,407
14년 전 조회 2,170
14년 전 조회 1,508
14년 전 조회 2,127
14년 전 조회 1,692
14년 전 조회 1,349
14년 전 조회 3,418
14년 전 조회 1,876
14년 전 조회 1,320
14년 전 조회 1,196
14년 전 조회 1,882
14년 전 조회 1,283
14년 전 조회 1,080
14년 전 조회 1,022
14년 전 조회 2,261
14년 전 조회 941
14년 전 조회 1,171
14년 전 조회 1,935
14년 전 조회 1,260
14년 전 조회 1,264
14년 전 조회 1,801
14년 전 조회 1,473
14년 전 조회 1,534
14년 전 조회 1,326
14년 전 조회 2,622
14년 전 조회 1,426
14년 전 조회 1,107
14년 전 조회 1,324
14년 전 조회 1,087
14년 전 조회 1,122
14년 전 조회 945
14년 전 조회 1,149
14년 전 조회 1,525
14년 전 조회 1,757
14년 전 조회 1,314
14년 전 조회 1,390
14년 전 조회 1,242
14년 전 조회 1,435
14년 전 조회 1,708
14년 전 조회 1,476
14년 전 조회 1,708
14년 전 조회 1,434
14년 전 조회 1,370
14년 전 조회 1,392
14년 전 조회 1,366
14년 전 조회 1,886
14년 전 조회 1,832
14년 전 조회 1,637
14년 전 조회 1,740
14년 전 조회 1,982
14년 전 조회 960
14년 전 조회 1,429