COMING SOON 🚀

D

유트브영상 순간검색 구현

· 14년 전 · 2318 · 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,929
14년 전 조회 1,020
14년 전 조회 1,246
14년 전 조회 1,307
14년 전 조회 1,666
14년 전 조회 1,262
14년 전 조회 1,566
14년 전 조회 3,522
14년 전 조회 1,881
14년 전 조회 1,287
14년 전 조회 2,042
14년 전 조회 1,438
14년 전 조회 950
14년 전 조회 2,868
14년 전 조회 1,243
14년 전 조회 1,305
14년 전 조회 1,605
14년 전 조회 1,480
14년 전 조회 1,497
14년 전 조회 1,053
14년 전 조회 2,927
14년 전 조회 1,319
14년 전 조회 1,937
14년 전 조회 1,531
14년 전 조회 1,536
14년 전 조회 1,273
14년 전 조회 1,559
14년 전 조회 1,126
14년 전 조회 1,148
14년 전 조회 1,978
14년 전 조회 1,718
14년 전 조회 1,537
14년 전 조회 1,568
14년 전 조회 2,376
14년 전 조회 1,974
14년 전 조회 1,099
14년 전 조회 1,952
14년 전 조회 1,732
14년 전 조회 1,813
14년 전 조회 1,317
14년 전 조회 1,341
14년 전 조회 1,309
14년 전 조회 1,288
14년 전 조회 1,929
14년 전 조회 1,259
14년 전 조회 1,554
14년 전 조회 1,823
14년 전 조회 1,883
14년 전 조회 1,582
14년 전 조회 2,319
14년 전 조회 1,652
14년 전 조회 2,286
14년 전 조회 1,854
14년 전 조회 1,511
14년 전 조회 3,582
14년 전 조회 2,044
14년 전 조회 1,497
14년 전 조회 1,363
14년 전 조회 2,040
14년 전 조회 1,436
14년 전 조회 1,233
14년 전 조회 1,171
14년 전 조회 2,421
14년 전 조회 1,098
14년 전 조회 1,319
14년 전 조회 2,094
14년 전 조회 1,411
14년 전 조회 1,418
14년 전 조회 1,944
14년 전 조회 1,641
14년 전 조회 1,693
14년 전 조회 1,488
14년 전 조회 2,790
14년 전 조회 1,576
14년 전 조회 1,256
14년 전 조회 1,492
14년 전 조회 1,239
14년 전 조회 1,266
14년 전 조회 1,101
14년 전 조회 1,305
14년 전 조회 1,680
14년 전 조회 1,925
14년 전 조회 1,415
14년 전 조회 1,576
14년 전 조회 1,406
14년 전 조회 1,596
14년 전 조회 1,860
14년 전 조회 1,646
14년 전 조회 1,868
14년 전 조회 1,606
14년 전 조회 1,539
14년 전 조회 1,566
14년 전 조회 1,534
14년 전 조회 2,061
14년 전 조회 1,992
14년 전 조회 1,808
14년 전 조회 1,907
14년 전 조회 2,146
14년 전 조회 1,141
14년 전 조회 1,602