D

유트브영상 순간검색 구현

· 14년 전 · 2144 · 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
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

태그 필터 (최대 3개) 전체 개발자 소스 기타 mysql 팁자료실 javascript php linux flash 정규표현식 jquery node.js mobile 웹서버 os 프로그램 강좌 썸네일 이미지관련 도로명주소 그누보드5 기획자 견적서 계약서 기획서 마케팅 제안서 seo 통계 서식 통계자료 퍼블리셔 html css 반응형 웹접근성 퍼블리싱 표준화 반응형웹 홈페이지기초 부트스트랩 angularjs 포럼 스크린리더 센스리더 개발자톡 개발자팁 퍼블리셔톡 퍼블리셔팁 기획자톡 기획자팁 프로그램강좌 퍼블리싱강좌
+
제목 글쓴이 날짜 조회
14년 전 조회 1,743
14년 전 조회 842
14년 전 조회 1,057
14년 전 조회 1,111
14년 전 조회 1,472
14년 전 조회 1,083
14년 전 조회 1,377
14년 전 조회 3,324
14년 전 조회 1,694
14년 전 조회 1,090
14년 전 조회 1,867
14년 전 조회 1,238
14년 전 조회 763
14년 전 조회 2,675
14년 전 조회 1,070
14년 전 조회 1,136
14년 전 조회 1,418
14년 전 조회 1,297
14년 전 조회 1,322
14년 전 조회 882
14년 전 조회 2,758
14년 전 조회 1,140
14년 전 조회 1,772
14년 전 조회 1,405
14년 전 조회 1,413
14년 전 조회 1,136
14년 전 조회 1,417
14년 전 조회 994
14년 전 조회 1,004
14년 전 조회 1,840
14년 전 조회 1,585
14년 전 조회 1,390
14년 전 조회 1,444
14년 전 조회 2,193
14년 전 조회 1,798
14년 전 조회 949
14년 전 조회 1,785
14년 전 조회 1,571
14년 전 조회 1,649
14년 전 조회 1,135
14년 전 조회 1,157
14년 전 조회 1,131
14년 전 조회 1,089
14년 전 조회 1,740
14년 전 조회 1,082
14년 전 조회 1,378
14년 전 조회 1,643
14년 전 조회 1,708
14년 전 조회 1,381
14년 전 조회 2,145
14년 전 조회 1,479
14년 전 조회 2,100
14년 전 조회 1,663
14년 전 조회 1,317
14년 전 조회 3,391
14년 전 조회 1,842
14년 전 조회 1,292
14년 전 조회 1,165
14년 전 조회 1,855
14년 전 조회 1,256
14년 전 조회 1,053
14년 전 조회 993
14년 전 조회 2,227
14년 전 조회 912
14년 전 조회 1,140
14년 전 조회 1,907
14년 전 조회 1,239
14년 전 조회 1,236
14년 전 조회 1,773
14년 전 조회 1,446
14년 전 조회 1,511
14년 전 조회 1,287
14년 전 조회 2,594
14년 전 조회 1,394
14년 전 조회 1,083
14년 전 조회 1,292
14년 전 조회 1,056
14년 전 조회 1,096
14년 전 조회 920
14년 전 조회 1,118
14년 전 조회 1,493
14년 전 조회 1,732
14년 전 조회 1,284
14년 전 조회 1,359
14년 전 조회 1,212
14년 전 조회 1,406
14년 전 조회 1,681
14년 전 조회 1,450
14년 전 조회 1,674
14년 전 조회 1,412
14년 전 조회 1,339
14년 전 조회 1,355
14년 전 조회 1,340
14년 전 조회 1,858
14년 전 조회 1,806
14년 전 조회 1,606
14년 전 조회 1,714
14년 전 조회 1,948
14년 전 조회 935
14년 전 조회 1,389