D

유트브영상 순간검색 구현

· 14년 전 · 2260 · 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,866
14년 전 조회 966
14년 전 조회 1,187
14년 전 조회 1,243
14년 전 조회 1,603
14년 전 조회 1,205
14년 전 조회 1,511
14년 전 조회 3,436
14년 전 조회 1,825
14년 전 조회 1,215
14년 전 조회 1,991
14년 전 조회 1,380
14년 전 조회 892
14년 전 조회 2,802
14년 전 조회 1,193
14년 전 조회 1,255
14년 전 조회 1,546
14년 전 조회 1,420
14년 전 조회 1,446
14년 전 조회 1,010
14년 전 조회 2,873
14년 전 조회 1,261
14년 전 조회 1,888
14년 전 조회 1,487
14년 전 조회 1,501
14년 전 조회 1,233
14년 전 조회 1,503
14년 전 조회 1,081
14년 전 조회 1,094
14년 전 조회 1,932
14년 전 조회 1,678
14년 전 조회 1,481
14년 전 조회 1,532
14년 전 조회 2,312
14년 전 조회 1,914
14년 전 조회 1,061
14년 전 조회 1,909
14년 전 조회 1,688
14년 전 조회 1,767
14년 전 조회 1,255
14년 전 조회 1,280
14년 전 조회 1,256
14년 전 조회 1,213
14년 전 조회 1,861
14년 전 조회 1,200
14년 전 조회 1,505
14년 전 조회 1,766
14년 전 조회 1,835
14년 전 조회 1,519
14년 전 조회 2,261
14년 전 조회 1,602
14년 전 조회 2,226
14년 전 조회 1,779
14년 전 조회 1,436
14년 전 조회 3,507
14년 전 조회 1,976
14년 전 조회 1,426
14년 전 조회 1,297
14년 전 조회 1,970
14년 전 조회 1,365
14년 전 조회 1,168
14년 전 조회 1,110
14년 전 조회 2,348
14년 전 조회 1,036
14년 전 조회 1,251
14년 전 조회 2,027
14년 전 조회 1,351
14년 전 조회 1,360
14년 전 조회 1,890
14년 전 조회 1,575
14년 전 조회 1,632
14년 전 조회 1,418
14년 전 조회 2,724
14년 전 조회 1,516
14년 전 조회 1,191
14년 전 조회 1,423
14년 전 조회 1,183
14년 전 조회 1,210
14년 전 조회 1,043
14년 전 조회 1,241
14년 전 조회 1,618
14년 전 조회 1,856
14년 전 조회 1,370
14년 전 조회 1,499
14년 전 조회 1,340
14년 전 조회 1,527
14년 전 조회 1,805
14년 전 조회 1,577
14년 전 조회 1,805
14년 전 조회 1,542
14년 전 조회 1,476
14년 전 조회 1,495
14년 전 조회 1,467
14년 전 조회 1,994
14년 전 조회 1,934
14년 전 조회 1,725
14년 전 조회 1,832
14년 전 조회 2,082
14년 전 조회 1,075
14년 전 조회 1,525