D

유트브영상 순간검색 구현

· 14년 전 · 1863 · 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,460
14년 전 조회 581
14년 전 조회 781
14년 전 조회 837
14년 전 조회 1,195
14년 전 조회 810
14년 전 조회 1,097
14년 전 조회 3,040
14년 전 조회 1,411
14년 전 조회 797
14년 전 조회 1,595
14년 전 조회 962
14년 전 조회 503
14년 전 조회 2,389
14년 전 조회 784
14년 전 조회 843
14년 전 조회 1,152
14년 전 조회 1,025
14년 전 조회 1,061
14년 전 조회 592
14년 전 조회 2,467
14년 전 조회 882
14년 전 조회 1,497
14년 전 조회 1,176
14년 전 조회 1,181
14년 전 조회 886
14년 전 조회 1,181
14년 전 조회 750
14년 전 조회 776
14년 전 조회 1,598
14년 전 조회 1,354
14년 전 조회 1,168
14년 전 조회 1,213
14년 전 조회 1,938
14년 전 조회 1,517
14년 전 조회 625
14년 전 조회 1,508
14년 전 조회 1,283
14년 전 조회 1,368
14년 전 조회 846
14년 전 조회 885
14년 전 조회 840
14년 전 조회 825
14년 전 조회 1,449
14년 전 조회 787
14년 전 조회 1,084
14년 전 조회 1,359
14년 전 조회 1,413
14년 전 조회 1,095
14년 전 조회 1,864
14년 전 조회 1,182
14년 전 조회 1,830
14년 전 조회 1,384
14년 전 조회 1,029
14년 전 조회 3,107
14년 전 조회 1,555
14년 전 조회 1,027
14년 전 조회 877
14년 전 조회 1,563
14년 전 조회 979
14년 전 조회 786
14년 전 조회 706
14년 전 조회 1,952
14년 전 조회 615
14년 전 조회 855
14년 전 조회 1,616
14년 전 조회 957
14년 전 조회 940
14년 전 조회 1,490
14년 전 조회 1,162
14년 전 조회 1,238
14년 전 조회 1,026
14년 전 조회 2,326
14년 전 조회 1,112
14년 전 조회 844
14년 전 조회 1,015
14년 전 조회 776
14년 전 조회 807
14년 전 조회 633
14년 전 조회 846
14년 전 조회 1,221
14년 전 조회 1,451
14년 전 조회 919
14년 전 조회 1,072
14년 전 조회 925
14년 전 조회 1,109
14년 전 조회 1,380
14년 전 조회 1,150
14년 전 조회 1,349
14년 전 조회 1,123
14년 전 조회 1,052
14년 전 조회 1,083
14년 전 조회 1,032
14년 전 조회 1,561
14년 전 조회 1,506
14년 전 조회 1,315
14년 전 조회 1,417
14년 전 조회 1,652
14년 전 조회 645
14년 전 조회 1,095
🐛 버그신고