D

유트브영상 순간검색 구현

· 14년 전 · 2083 · 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,666
14년 전 조회 769
14년 전 조회 993
14년 전 조회 1,035
14년 전 조회 1,395
14년 전 조회 1,003
14년 전 조회 1,303
14년 전 조회 3,252
14년 전 조회 1,625
14년 전 조회 1,011
14년 전 조회 1,798
14년 전 조회 1,163
14년 전 조회 689
14년 전 조회 2,592
14년 전 조회 988
14년 전 조회 1,053
14년 전 조회 1,349
14년 전 조회 1,232
14년 전 조회 1,254
14년 전 조회 806
14년 전 조회 2,683
14년 전 조회 1,078
14년 전 조회 1,712
14년 전 조회 1,354
14년 전 조회 1,360
14년 전 조회 1,090
14년 전 조회 1,357
14년 전 조회 935
14년 전 조회 959
14년 전 조회 1,791
14년 전 조회 1,546
14년 전 조회 1,347
14년 전 조회 1,392
14년 전 조회 2,138
14년 전 조회 1,723
14년 전 조회 869
14년 전 조회 1,717
14년 전 조회 1,487
14년 전 조회 1,572
14년 전 조회 1,059
14년 전 조회 1,087
14년 전 조회 1,047
14년 전 조회 1,033
14년 전 조회 1,656
14년 전 조회 1,009
14년 전 조회 1,304
14년 전 조회 1,560
14년 전 조회 1,622
14년 전 조회 1,299
14년 전 조회 2,084
14년 전 조회 1,397
14년 전 조회 2,030
14년 전 조회 1,603
14년 전 조회 1,238
14년 전 조회 3,315
14년 전 조회 1,769
14년 전 조회 1,214
14년 전 조회 1,090
14년 전 조회 1,789
14년 전 조회 1,186
14년 전 조회 972
14년 전 조회 920
14년 전 조회 2,161
14년 전 조회 832
14년 전 조회 1,056
14년 전 조회 1,836
14년 전 조회 1,150
14년 전 조회 1,166
14년 전 조회 1,709
14년 전 조회 1,374
14년 전 조회 1,426
14년 전 조회 1,233
14년 전 조회 2,533
14년 전 조회 1,322
14년 전 조회 1,015
14년 전 조회 1,227
14년 전 조회 984
14년 전 조회 1,009
14년 전 조회 852
14년 전 조회 1,055
14년 전 조회 1,429
14년 전 조회 1,654
14년 전 조회 1,168
14년 전 조회 1,287
14년 전 조회 1,140
14년 전 조회 1,321
14년 전 조회 1,600
14년 전 조회 1,375
14년 전 조회 1,597
14년 전 조회 1,342
14년 전 조회 1,262
14년 전 조회 1,269
14년 전 조회 1,247
14년 전 조회 1,778
14년 전 조회 1,745
14년 전 조회 1,528
14년 전 조회 1,636
14년 전 조회 1,862
14년 전 조회 856
14년 전 조회 1,318