D

유트브영상 순간검색 구현

· 14년 전 · 2181 · 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,783
14년 전 조회 884
14년 전 조회 1,097
14년 전 조회 1,156
14년 전 조회 1,518
14년 전 조회 1,126
14년 전 조회 1,428
14년 전 조회 3,361
14년 전 조회 1,734
14년 전 조회 1,130
14년 전 조회 1,907
14년 전 조회 1,285
14년 전 조회 808
14년 전 조회 2,716
14년 전 조회 1,109
14년 전 조회 1,177
14년 전 조회 1,460
14년 전 조회 1,337
14년 전 조회 1,369
14년 전 조회 921
14년 전 조회 2,794
14년 전 조회 1,178
14년 전 조회 1,816
14년 전 조회 1,436
14년 전 조회 1,451
14년 전 조회 1,183
14년 전 조회 1,452
14년 전 조회 1,029
14년 전 조회 1,046
14년 전 조회 1,877
14년 전 조회 1,622
14년 전 조회 1,429
14년 전 조회 1,474
14년 전 조회 2,228
14년 전 조회 1,835
14년 전 조회 985
14년 전 조회 1,828
14년 전 조회 1,612
14년 전 조회 1,693
14년 전 조회 1,178
14년 전 조회 1,200
14년 전 조회 1,173
14년 전 조회 1,128
14년 전 조회 1,782
14년 전 조회 1,122
14년 전 조회 1,420
14년 전 조회 1,686
14년 전 조회 1,751
14년 전 조회 1,421
14년 전 조회 2,182
14년 전 조회 1,524
14년 전 조회 2,144
14년 전 조회 1,707
14년 전 조회 1,360
14년 전 조회 3,425
14년 전 조회 1,893
14년 전 조회 1,336
14년 전 조회 1,209
14년 전 조회 1,893
14년 전 조회 1,290
14년 전 조회 1,091
14년 전 조회 1,039
14년 전 조회 2,277
14년 전 조회 954
14년 전 조회 1,185
14년 전 조회 1,948
14년 전 조회 1,276
14년 전 조회 1,281
14년 전 조회 1,814
14년 전 조회 1,488
14년 전 조회 1,550
14년 전 조회 1,342
14년 전 조회 2,634
14년 전 조회 1,441
14년 전 조회 1,121
14년 전 조회 1,340
14년 전 조회 1,099
14년 전 조회 1,134
14년 전 조회 965
14년 전 조회 1,163
14년 전 조회 1,535
14년 전 조회 1,771
14년 전 조회 1,328
14년 전 조회 1,403
14년 전 조회 1,259
14년 전 조회 1,449
14년 전 조회 1,721
14년 전 조회 1,488
14년 전 조회 1,718
14년 전 조회 1,452
14년 전 조회 1,389
14년 전 조회 1,399
14년 전 조회 1,385
14년 전 조회 1,906
14년 전 조회 1,851
14년 전 조회 1,653
14년 전 조회 1,755
14년 전 조회 1,998
14년 전 조회 972
14년 전 조회 1,446