<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Hello World - Google Web Search API Sample</title>
<script src="https://www.google.com/jsapi"
type="text/javascript"></script>
<script language="Javascript" type="text/javascript">
google.load('search', '1');
function OnLoad()
{
var searchControl = new google.search.SearchControl();
var imgSearch = new google.search.ImageSearch();
searchControl.addSearcher(imgSearch);
imgSearch.setResultSetSize(8);
searchControl.draw(document.getElementById("searchcontrol"));
searchControl.execute("facebook");
}
google.setOnLoadCallback(OnLoad);
</script>
</head>
<body>
<div id="searchcontrol">Loading</div>
</body>
</html>
เรื่องรายละเอียดว่าแต่ละบรรทัดทำอะไรนั่นผมได้เขียนอธิบายไวในบทความนี้แล้วนะครับสามารถอ่านเพิ่มเติมได้นะครับ แต่สำหรับจุดสำคัญสำหรับการจำกัดว่าจะให้แสดงผลครั้งละ 8 ภาพนั่นอยู่ที่
imgSearch.setResultSetSize(8);
แค่นั่นเองครับ โดยตัวเลขที่เราสามารถระบุได้นั่นจะเป็นเลข 1, 2, 4, 8 เท่านั่นนะครับ
ถ้าท่านผุ้อ่านอ่านแล้วมีประโยช์นอย่างลืมไปกอ Like Page ให้หน่อยนะครับ :-) ช่วงนี้กำลังทำยอดนะครับ แหะๆ http://www.facebook.com/PStudioDev
