D

유트브영상 순간검색 구현

· 14년 전 · 2242 · 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,836
14년 전 조회 937
14년 전 조회 1,153
14년 전 조회 1,212
14년 전 조회 1,574
14년 전 조회 1,184
14년 전 조회 1,483
14년 전 조회 3,402
14년 전 조회 1,794
14년 전 조회 1,186
14년 전 조회 1,959
14년 전 조회 1,344
14년 전 조회 855
14년 전 조회 2,777
14년 전 조회 1,161
14년 전 조회 1,226
14년 전 조회 1,512
14년 전 조회 1,392
14년 전 조회 1,421
14년 전 조회 976
14년 전 조회 2,850
14년 전 조회 1,240
14년 전 조회 1,858
14년 전 조회 1,464
14년 전 조회 1,482
14년 전 조회 1,208
14년 전 조회 1,482
14년 전 조회 1,060
14년 전 조회 1,078
14년 전 조회 1,915
14년 전 조회 1,654
14년 전 조회 1,461
14년 전 조회 1,516
14년 전 조회 2,281
14년 전 조회 1,884
14년 전 조회 1,034
14년 전 조회 1,878
14년 전 조회 1,661
14년 전 조회 1,736
14년 전 조회 1,226
14년 전 조회 1,253
14년 전 조회 1,220
14년 전 조회 1,188
14년 전 조회 1,841
14년 전 조회 1,167
14년 전 조회 1,482
14년 전 조회 1,737
14년 전 조회 1,802
14년 전 조회 1,475
14년 전 조회 2,243
14년 전 조회 1,576
14년 전 조회 2,198
14년 전 조회 1,750
14년 전 조회 1,407
14년 전 조회 3,491
14년 전 조회 1,950
14년 전 조회 1,394
14년 전 조회 1,273
14년 전 조회 1,943
14년 전 조회 1,342
14년 전 조회 1,146
14년 전 조회 1,089
14년 전 조회 2,327
14년 전 조회 1,007
14년 전 조회 1,232
14년 전 조회 2,000
14년 전 조회 1,327
14년 전 조회 1,333
14년 전 조회 1,855
14년 전 조회 1,539
14년 전 조회 1,600
14년 전 조회 1,387
14년 전 조회 2,689
14년 전 조회 1,489
14년 전 조회 1,165
14년 전 조회 1,389
14년 전 조회 1,149
14년 전 조회 1,193
14년 전 조회 1,015
14년 전 조회 1,211
14년 전 조회 1,594
14년 전 조회 1,826
14년 전 조회 1,354
14년 전 조회 1,469
14년 전 조회 1,319
14년 전 조회 1,502
14년 전 조회 1,779
14년 전 조회 1,546
14년 전 조회 1,775
14년 전 조회 1,512
14년 전 조회 1,448
14년 전 조회 1,459
14년 전 조회 1,438
14년 전 조회 1,964
14년 전 조회 1,907
14년 전 조회 1,700
14년 전 조회 1,809
14년 전 조회 2,051
14년 전 조회 1,045
14년 전 조회 1,501