D

유트브영상 순간검색 구현

· 14년 전 · 2278 · 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,884
14년 전 조회 987
14년 전 조회 1,200
14년 전 조회 1,269
14년 전 조회 1,623
14년 전 조회 1,221
14년 전 조회 1,524
14년 전 조회 3,468
14년 전 조회 1,851
14년 전 조회 1,245
14년 전 조회 2,008
14년 전 조회 1,401
14년 전 조회 917
14년 전 조회 2,824
14년 전 조회 1,214
14년 전 조회 1,275
14년 전 조회 1,566
14년 전 조회 1,450
14년 전 조회 1,465
14년 전 조회 1,030
14년 전 조회 2,898
14년 전 조회 1,283
14년 전 조회 1,906
14년 전 조회 1,501
14년 전 조회 1,514
14년 전 조회 1,245
14년 전 조회 1,524
14년 전 조회 1,101
14년 전 조회 1,118
14년 전 조회 1,952
14년 전 조회 1,690
14년 전 조회 1,497
14년 전 조회 1,544
14년 전 조회 2,334
14년 전 조회 1,941
14년 전 조회 1,075
14년 전 조회 1,921
14년 전 조회 1,709
14년 전 조회 1,780
14년 전 조회 1,275
14년 전 조회 1,305
14년 전 조회 1,275
14년 전 조회 1,236
14년 전 조회 1,889
14년 전 조회 1,224
14년 전 조회 1,523
14년 전 조회 1,787
14년 전 조회 1,852
14년 전 조회 1,547
14년 전 조회 2,279
14년 전 조회 1,619
14년 전 조회 2,254
14년 전 조회 1,805
14년 전 조회 1,469
14년 전 조회 3,527
14년 전 조회 1,997
14년 전 조회 1,450
14년 전 조회 1,326
14년 전 조회 2,003
14년 전 조회 1,392
14년 전 조회 1,188
14년 전 조회 1,134
14년 전 조회 2,373
14년 전 조회 1,068
14년 전 조회 1,282
14년 전 조회 2,054
14년 전 조회 1,379
14년 전 조회 1,383
14년 전 조회 1,908
14년 전 조회 1,599
14년 전 조회 1,654
14년 전 조회 1,445
14년 전 조회 2,754
14년 전 조회 1,533
14년 전 조회 1,218
14년 전 조회 1,450
14년 전 조회 1,202
14년 전 조회 1,232
14년 전 조회 1,066
14년 전 조회 1,259
14년 전 조회 1,635
14년 전 조회 1,878
14년 전 조회 1,384
14년 전 조회 1,526
14년 전 조회 1,360
14년 전 조회 1,544
14년 전 조회 1,823
14년 전 조회 1,600
14년 전 조회 1,831
14년 전 조회 1,563
14년 전 조회 1,492
14년 전 조회 1,519
14년 전 조회 1,492
14년 전 조회 2,017
14년 전 조회 1,960
14년 전 조회 1,759
14년 전 조회 1,859
14년 전 조회 2,106
14년 전 조회 1,102
14년 전 조회 1,558