D

유트브영상 순간검색 구현

· 14년 전 · 2418 · 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,001
14년 전 조회 1,105
14년 전 조회 1,342
14년 전 조회 1,394
14년 전 조회 1,752
14년 전 조회 1,355
14년 전 조회 1,650
14년 전 조회 3,593
14년 전 조회 1,978
14년 전 조회 1,368
14년 전 조회 2,129
14년 전 조회 1,521
14년 전 조회 1,036
14년 전 조회 2,963
14년 전 조회 1,352
14년 전 조회 1,401
14년 전 조회 1,696
14년 전 조회 1,578
14년 전 조회 1,598
14년 전 조회 1,149
14년 전 조회 3,007
14년 전 조회 1,412
14년 전 조회 2,023
14년 전 조회 1,626
14년 전 조회 1,619
14년 전 조회 1,375
14년 전 조회 1,654
14년 전 조회 1,225
14년 전 조회 1,234
14년 전 조회 2,069
14년 전 조회 1,809
14년 전 조회 1,638
14년 전 조회 1,659
14년 전 조회 2,474
14년 전 조회 2,061
14년 전 조회 1,188
14년 전 조회 2,043
14년 전 조회 1,825
14년 전 조회 1,893
14년 전 조회 1,416
14년 전 조회 1,446
14년 전 조회 1,420
14년 전 조회 1,384
14년 전 조회 2,012
14년 전 조회 1,351
14년 전 조회 1,648
14년 전 조회 1,923
14년 전 조회 2,000
14년 전 조회 1,680
14년 전 조회 2,419
14년 전 조회 1,759
14년 전 조회 2,391
14년 전 조회 1,959
14년 전 조회 1,608
14년 전 조회 3,688
14년 전 조회 2,149
14년 전 조회 1,614
14년 전 조회 1,456
14년 전 조회 2,146
14년 전 조회 1,540
14년 전 조회 1,344
14년 전 조회 1,275
14년 전 조회 2,529
14년 전 조회 1,179
14년 전 조회 1,406
14년 전 조회 2,199
14년 전 조회 1,527
14년 전 조회 1,504
14년 전 조회 2,064
14년 전 조회 1,728
14년 전 조회 1,806
14년 전 조회 1,601
14년 전 조회 2,892
14년 전 조회 1,691
14년 전 조회 1,359
14년 전 조회 1,588
14년 전 조회 1,343
14년 전 조회 1,369
14년 전 조회 1,210
14년 전 조회 1,412
14년 전 조회 1,794
14년 전 조회 2,043
14년 전 조회 1,530
14년 전 조회 1,683
14년 전 조회 1,516
14년 전 조회 1,702
14년 전 조회 1,957
14년 전 조회 1,733
14년 전 조회 1,964
14년 전 조회 1,717
14년 전 조회 1,644
14년 전 조회 1,667
14년 전 조회 1,646
14년 전 조회 2,160
14년 전 조회 2,101
14년 전 조회 1,909
14년 전 조회 2,020
14년 전 조회 2,244
14년 전 조회 1,225
14년 전 조회 1,691