<link rel='stylesheet' href='global.css'>
<script language="javascript" charset="gb2312" src="js/jquery-1.4.2.js"></script>
<table width="100%" style="align:center;" align="center">
<tr>
<td colspan="2">
<form action="#" id="top-form">
<label for="top-keywords" accesskey="2" class="inside">Search</label>
<input type="hidden" name="section" value="all" />
<input type="text" name="s" id="top-keywords" value="" />
<input type="image" id="top-submit" src="search.gif" alt="Search"/>
</form>
</td>
</tr>
<tr>
<!--
<td valign="top">
<div class="left">
<div class="module list" id="newtothestore">
<h2><span>购物网站列表</span></h2>
<div class="modulecontent" style="text-align:left;">
<ul>
1
</ul>
</div>
<div class="module_btm"> </div>
</div>
</div>
</td>
-->
<td valign="top" width="100%" colspan="2">
<div id="member-group-tab" class="clearfix">
<span id="member-tab1" class="active" onclick="tab(1)">按价格</span>
<span id="member-tab2" onclick="tab(2)">按网站</span>
<span id="member-tab3" onclick="tab(3)">按日期</span>
</div>
<div id="member-wrapper" class="clearfix active">
<!-- 排行开始 -->
<ul class="member-group-list" id="content-list">
<!--
<li class="visible" >
<div class="name"><span><img src="" width="15" height="15"></span><span>网站</span></div>
<div class="popularity">RMB:100</div>
</li>
-->
</ul>
</div>
</td>
</table>
<SCRIPT LANGUAGE="JavaScript">
<!--
$("#top-submit").bind("click",function(){
var query = $("#top-keywords").val();
query = encodeURIComponent(query);
var list =$("#content-list");
/*
$.getJSON("http://166.111.68.52/chrome/api/product.php",{query:query},function callback(json){
//var userlist = $.parseJSON(json);
//alert(userlist);
if( null == json )
{
list.html("对不起,暂时没找到您需要的结果");
}
else{
wirteHtml(json);
}
});
*/
$.ajax({
url:"http://166.111.68.52/chrome/api/product.php",
type:"GET",
dataType:"json",
timeout:1000,
data:{query:query},
cache:false,
success:function(json){
if( null == json )
{
list.html("对不起,暂时没找到您需要的结果");
}
else{
wirteHtml(json);
}
},
error:function(xhr, ajaxOptions, thrownError){
list.html("网络传输错误..."+xhr.status+":");
}
});
});
function wirteHtml(data){
var list =$("#content-list");
list.html("");
$.each(data, function(i,item){
var product = '<li class="visible" id="content-list"><div class="name"><span><img src="'+item.image+'" width="15" height="15"></span><span style="padding-left:5px;">['+item.website+']<a href="'+item.surl+'" id="surlElement" onclick="goUrl(this);">'+item.name+'</a></span></div><div class="popularity">RMB:'+item.price+'</div></li>';
list.html(list.html()+product);
});
if( "" == list.html() )
{
list.html("对不起,暂时没找到您需要的结果");
}
}
function goUrl(event){
var url = "http://www.baidu.com/";
url = event.href+"/";
chrome.tabs.create({"url":url}, function callback(){});
};
function tab(num){
$("#member-tab1").removeClass("active");
$("#member-tab2").removeClass("active");
$("#member-tab3").removeClass("active");
$("#member-tab"+num).addClass("active");
}
//-->
</SCRIPT>