D

유트브영상 순간검색 구현

· 14년 전 · 2237 · 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,833
14년 전 조회 935
14년 전 조회 1,150
14년 전 조회 1,206
14년 전 조회 1,569
14년 전 조회 1,177
14년 전 조회 1,479
14년 전 조회 3,399
14년 전 조회 1,788
14년 전 조회 1,180
14년 전 조회 1,957
14년 전 조회 1,342
14년 전 조회 850
14년 전 조회 2,771
14년 전 조회 1,157
14년 전 조회 1,221
14년 전 조회 1,506
14년 전 조회 1,387
14년 전 조회 1,417
14년 전 조회 972
14년 전 조회 2,846
14년 전 조회 1,237
14년 전 조회 1,853
14년 전 조회 1,464
14년 전 조회 1,480
14년 전 조회 1,208
14년 전 조회 1,481
14년 전 조회 1,059
14년 전 조회 1,076
14년 전 조회 1,913
14년 전 조회 1,653
14년 전 조회 1,456
14년 전 조회 1,511
14년 전 조회 2,278
14년 전 조회 1,881
14년 전 조회 1,026
14년 전 조회 1,875
14년 전 조회 1,658
14년 전 조회 1,734
14년 전 조회 1,221
14년 전 조회 1,249
14년 전 조회 1,218
14년 전 조회 1,183
14년 전 조회 1,839
14년 전 조회 1,161
14년 전 조회 1,478
14년 전 조회 1,733
14년 전 조회 1,796
14년 전 조회 1,470
14년 전 조회 2,238
14년 전 조회 1,571
14년 전 조회 2,193
14년 전 조회 1,748
14년 전 조회 1,406
14년 전 조회 3,489
14년 전 조회 1,940
14년 전 조회 1,393
14년 전 조회 1,269
14년 전 조회 1,939
14년 전 조회 1,339
14년 전 조회 1,142
14년 전 조회 1,085
14년 전 조회 2,323
14년 전 조회 1,002
14년 전 조회 1,230
14년 전 조회 1,998
14년 전 조회 1,324
14년 전 조회 1,326
14년 전 조회 1,850
14년 전 조회 1,533
14년 전 조회 1,597
14년 전 조회 1,384
14년 전 조회 2,685
14년 전 조회 1,481
14년 전 조회 1,162
14년 전 조회 1,381
14년 전 조회 1,144
14년 전 조회 1,185
14년 전 조회 1,014
14년 전 조회 1,206
14년 전 조회 1,587
14년 전 조회 1,819
14년 전 조회 1,352
14년 전 조회 1,464
14년 전 조회 1,316
14년 전 조회 1,495
14년 전 조회 1,776
14년 전 조회 1,540
14년 전 조회 1,770
14년 전 조회 1,508
14년 전 조회 1,447
14년 전 조회 1,455
14년 전 조회 1,432
14년 전 조회 1,958
14년 전 조회 1,903
14년 전 조회 1,695
14년 전 조회 1,804
14년 전 조회 2,047
14년 전 조회 1,044
14년 전 조회 1,498