D

유트브영상 순간검색 구현

· 14년 전 · 2270 · 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,876
14년 전 조회 977
14년 전 조회 1,193
14년 전 조회 1,256
14년 전 조회 1,610
14년 전 조회 1,212
14년 전 조회 1,521
14년 전 조회 3,452
14년 전 조회 1,838
14년 전 조회 1,232
14년 전 조회 1,999
14년 전 조회 1,388
14년 전 조회 905
14년 전 조회 2,811
14년 전 조회 1,205
14년 전 조회 1,266
14년 전 조회 1,556
14년 전 조회 1,432
14년 전 조회 1,456
14년 전 조회 1,024
14년 전 조회 2,886
14년 전 조회 1,268
14년 전 조회 1,899
14년 전 조회 1,496
14년 전 조회 1,506
14년 전 조회 1,242
14년 전 조회 1,515
14년 전 조회 1,091
14년 전 조회 1,102
14년 전 조회 1,944
14년 전 조회 1,685
14년 전 조회 1,488
14년 전 조회 1,540
14년 전 조회 2,323
14년 전 조회 1,927
14년 전 조회 1,068
14년 전 조회 1,916
14년 전 조회 1,699
14년 전 조회 1,777
14년 전 조회 1,265
14년 전 조회 1,295
14년 전 조회 1,263
14년 전 조회 1,222
14년 전 조회 1,875
14년 전 조회 1,211
14년 전 조회 1,515
14년 전 조회 1,773
14년 전 조회 1,842
14년 전 조회 1,532
14년 전 조회 2,271
14년 전 조회 1,609
14년 전 조회 2,245
14년 전 조회 1,788
14년 전 조회 1,450
14년 전 조회 3,514
14년 전 조회 1,985
14년 전 조회 1,435
14년 전 조회 1,309
14년 전 조회 1,989
14년 전 조회 1,378
14년 전 조회 1,179
14년 전 조회 1,120
14년 전 조회 2,361
14년 전 조회 1,049
14년 전 조회 1,265
14년 전 조회 2,042
14년 전 조회 1,363
14년 전 조회 1,371
14년 전 조회 1,895
14년 전 조회 1,584
14년 전 조회 1,641
14년 전 조회 1,431
14년 전 조회 2,738
14년 전 조회 1,524
14년 전 조회 1,203
14년 전 조회 1,438
14년 전 조회 1,194
14년 전 조회 1,221
14년 전 조회 1,056
14년 전 조회 1,248
14년 전 조회 1,630
14년 전 조회 1,869
14년 전 조회 1,376
14년 전 조회 1,510
14년 전 조회 1,349
14년 전 조회 1,533
14년 전 조회 1,815
14년 전 조회 1,586
14년 전 조회 1,820
14년 전 조회 1,550
14년 전 조회 1,483
14년 전 조회 1,511
14년 전 조회 1,477
14년 전 조회 2,004
14년 전 조회 1,950
14년 전 조회 1,744
14년 전 조회 1,847
14년 전 조회 2,096
14년 전 조회 1,087
14년 전 조회 1,538