
Admin
Well-Known Member
Staff member
Administrator
HTML:
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
// Load the Search API
google.load('search', '1', {style : google.loader.themes.ESPRESSO});
// Set a callback to load the Custom Search Control when you page loads
google.setOnLoadCallback(
function(){
var customSearchControl = new google.search.CustomSearchControl(
'001362658779691933795:rdsiri6tbkg');
// Use "mysite_" as a unique ID to override the default rendering.
google.search.Csedr.addOverride("mysite_");
// Draw the Custom Search Control in the div named "CSE"
customSearchControl.draw('cse');
// Execute an initial search
customSearchControl.execute("{_$tukhoa|game}")
},
true);
</script>
</head>
<body><xt:code><div id="cse" style="width: 100%;">Loading</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'vi', style : google.loader.themes.V2_DEFAULT});
google.setOnLoadCallback(function() {
var customSearchOptions = {}; var customSearchControl = new google.search.CustomSearchControl(
'001362658779691933795:rdsiri6tbkg', customSearchOptions);
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
customSearchControl.draw('cse');
customSearchControl.execute("{_$tukhoa|game}");
},
true);
</script>
- tìm kiếm tùy chỉnh google
và phần
Giúp hiện thị trực tiếp keywordcustomSearchControl.execute("{_$tukhoa|game}");
trong đó có
Hàm gét của xtgem giúp ta thay đổi keyword nhanh và tiện.{_$tukhoa|game}
$tukhoa là giá trị sẽ hiển thị khi chạy.
Vd : http://tuoitreit.vn/tim-kiem/?tukhoa=tuoitreit.vn
Sẽ hiện kết quả tuoitreit.vn
Game sẽ hiện khi không có giá trị của
$tukhoa
Mã này có thể tuỳ chỉnh