Ragazzi,
visto che il regolamento dice che si può postare un nuovo messaggio dopo 24 ore dall'ultimo, ho ritenuto giusto scrivere qui invece di aprire una nuova discussione...
Allora, io ho trovato una script con le api di bing.
Ecco, la ricerca delle immagini ha più pagine di risultati e cliccando su ">>" va avanti con le pagine... invece la ricerca del web mi fa uscire solo 10 risultati in una singola pagina.
Ho provato a modificarlo con la funzione "offeset" ma nulla.
Vi posto il codice della ricerca immagini e della ricerca web (che vorrei fosse come quella della ricerca immagini, con molte pagine di risultati...)
eccolo: Immagini:
Codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Bing Instant with Jquery 9lessons</title>
<meta content='Bing Instant Search with Jquery' name='description'/>
<meta content='Bing Instant, 9lessons, PHP' name='keywords'/>
<script type="text/javascript" src="http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
var appId = '3B9C201E46EC29FA906BEF65B7A97C5B04DD18A9';
var offset = 0;
var perPage = 9;
$(document).ready(function(){
$(".search_input").focus();
$(".search_input").keyup(function(){
search(offset);
});
$('#offset_prev').click(function() {
offset = offset - perPage;
search(offset);
});
$('#offset_next').click(function() {
offset = offset + perPage;
search(offset);
});
function search(offset){
var search_input = $(".search_input").val();
var keyword= encodeURIComponent(search_input);
var yt_url='http://api.search.live.net/json.aspx?JsonType=callback&JsonCallback=?&Appid='+appId+'&query='+keyword+'&sources=image&Image.Count='+perPage+'&Image.Offset='+offset;
$.ajax({
type: "GET",
url: yt_url,
dataType:"jsonp",
success: function(response){
$("#result").html('');
if(response.SearchResponse.Image.Results.length){
$.each(response.SearchResponse.Image.Results, function(i,data)
{
var url=data.MediaUrl;
var thumb=data.Thumbnail.Url;
var dimw=data.Width;
var dimh=data.Height;
var final="<div class='webresult'><div class='title'><a href='"+url+"'><img src='"+thumb+"' /></a></div><div class='desc'>"+dimw+"X"+dimh+"</div></div>";
$("#result").append(final);
});
}else{
$("#result").html("<div id='no'>No results</div>");
}
}
});
}
});
</script>
<style>
body {
color:#000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
#container
{
margin:0 auto;
width:700px;
}
.search_input
{
border:2px solid #333;
font-size:20px;
padding:5px;
width:350px;
font-family:'Georgia', Times New Roman, Times, serif;
-moz-border-radius:5px;-webkit-border-radius:5px;
}
#input_box
{
text-align:left;
width:640px;
}
#result
{
text-align:left;
}
#no
{
padding:30px;
font-size:24px;
color:#fff;
}
.title
{
color:#006699;
font-size:16px;
padding-bottom:5px;
}
.title a
{
color:#cc0000;
text-decoration:none;
}
.desc
{
color:#333;
padding-bottom:5px;
}
.url
{
color:#006600;
}
.webresult
{
margin-top:10px;
padding-bottom:10px;
padding-left:5px;
border-bottom:1px dashed #dedede;
}
#offset_prev,#offset_next{
cursor:pointer;
}
</style>
</head>
<body>
<div id="container">
<div id="input_box">
<img src="bing4.png" /><br/>
<input type="text" class='search_input' />
<a id="offset_prev"><<</a>
<a id="offset_next">>></a>
</div>
<div id="result">
</div>
</div>
</body>
</html>
e web (con solo 10 risultati per pagina, ed io vorrei con molte pagine come nel codice precedente)
Codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Bing Instant with Jquery 9lessons</title>
<meta content='Bing Instant Search with Jquery' name='description'/>
<meta content='Bing Instant, 9lessons, PHP' name='keywords'/>
<script type="text/javascript" src="http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".search_input").focus();
$(".search_input").keyup(function()
{
var search_input = $(this).val();
var keyword= encodeURIComponent(search_input);
var yt_url='http://api.search.live.net/json.aspx?JsonType=callback&JsonCallback=?&Appid=3B9C201E46EC29FA906BEF65B7A97C5B1E204835&query='+keyword+'&sources=web';
$.ajax({
type: "GET",
url: yt_url,
dataType:"jsonp",
success: function(response)
{
$("#result").html('');
if(response.SearchResponse.Web.Results.length)
{
$.each(response.SearchResponse.Web.Results, function(i,data)
{
var title=data.Title;
var dis=data.Description;
var url=data.Url;
var final="<div class='webresult'><div class='title'><a href='"+url+"'>"+title+"</a></div><div class='desc'>"+dis+"</div><div class='url'>"+url+"</div></div>";
$("#result").append(final);
});
}
else
{
$("#result").html("<div id='no'>No results</div>");
}
}
});
});
});
</script>
<style>
body {
color:#000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
#container
{
margin:0 auto;
width:700px;
}
.search_input
{
border:2px solid #333;
font-size:20px;
padding:5px;
width:350px;
font-family:'Georgia', Times New Roman, Times, serif;
-moz-border-radius:5px;-webkit-border-radius:5px;
}
#input_box
{
text-align:left;
width:640px;
}
#result
{
text-align:left;
}
#no
{
padding:30px;
font-size:24px;
color:#fff;
}
.title
{
color:#006699;
font-size:16px;
padding-bottom:5px;
}
.title a
{
color:#cc0000;
text-decoration:none;
}
.desc
{
color:#333;
padding-bottom:5px;
}
.url
{
color:#006600;
}
.webresult
{
margin-top:10px;
padding-bottom:10px;
padding-left:5px;
border-bottom:1px dashed #dedede;
}
</style>
</head>
<body>
<div id="container">
<div id="input_box">
<img src="bing4.png" />
<input type="text" class='search_input' />
</div>
<div id="result">
</div>
</div>
</body>
</html>
Se volete provare li script, ecco le pagine:
La ricerca immagini (che va bene) : http://talkpluginorange.altervista.org/gsearch.html
e la ricerca web : http://talkpluginorange.altervista.org/home.html
Grazie mille