var pagesize =10;
var aa='';
var tttHTML='';
var tttHTML2='';
function reload_Info(httpData,myURL2){
var currpage = getPar("currpage");
if(currpage){
}else{
currpage = 1;
}
var sum = httpData['totalNum'];
if(sum == 0){
alert('没有相关产品!');
}
var tag ="test";
var sendurl = myURL2;
var parent=httpData['parent'];
var newHTML=''
var ho_id = '';
for(var i=0;i修改';
cz_str+='复制';
cz_str+='价格库存';
tempHTML2=tempHTML2.replace('[row操作]',cz_str);
tempHTML+=tempHTML2;
}
parStr = parStr.substr(0,parStr.length-1);
// parStr = parStr;
tempHTML=tempHTML.replace('oneCheck1',parStr);
// alert(parStr);
// alert($('.ace_check')[0].attr('name'));
// var checkList = $('.ace_check');
// checkList[i].attr("name",parStr);
// var onestr = $('#oneCheck').val(parStr);
newHTML+=tempHTML;
}
$('#one').html(newHTML);
getPager(sendurl, sum, currpage, pagesize,tag,'currpage');
}
window.onload=function (){
var keywords = getPar("keywords");
var saleStyle =getPar("saleStyle");
tttHTML=$('#row').prop('outerHTML');
tttHTML=tttHTML.replace('none','table-row');
tttHTML2=$('#two').prop('outerHTML');
tttHTML2=tttHTML2.replace('none','table-row');
//以下为非优化正常版本
// var myUrl1 = "./st-xm/Api/hotel_list.php";
// var myUrl2 = "hotel_list.html";
// if(keywords||saleStyle){
// currpage = getPar("currpage");
// aa = currpage;
// var myUrl1 = "./st-xm/Api/hotel_list.php?keywords="+keywords+"&saleStyle="+saleStyle+"&pagesize="+pagesize+"&currpage="+aa;
// var myUrl2 = "./hotel_list.html?keywords="+keywords+"&saleStyle="+saleStyle+"&pagesize="+pagesize;
// get_virtual_user_list(myUrl1,myUrl2);
// }
var currpage = getPar("currpage");
if(!currpage){
var keywords = $('#keywords').val();
var saleStyle = $('#if_onSale').val();
var myUrl1 = "./st-xm/Api/hotel_list.php?keywords="+keywords+"&saleStyle="+saleStyle+"&pagesize="+pagesize+"&currpage=1";
var myUrl2 = "./hotel_list.html?keywords="+keywords+"&saleStyle="+saleStyle+"&pagesize="+pagesize;
get_virtual_user_list(myUrl1,myUrl2);
}else{
var keywords = $('#keywords').val();
var saleStyle = $('#if_onSale').val();
var myUrl1 = "./st-xm/Api/hotel_list.php?keywords="+keywords+"&saleStyle="+saleStyle+"&pagesize="+pagesize+"&currpage="+currpage;
var myUrl2 = "./hotel_list.html?keywords="+keywords+"&saleStyle="+saleStyle+"&pagesize="+pagesize;
get_virtual_user_list(myUrl1,myUrl2);
}
}
/*======================网络请求的Ajax的代码=======================*/
// 创建一个Ajax对象
if (window.ActiveXObject){
var myreq = new ActiveXObject("Microsoft.XMLHTTP");
}else{
var myreq = new XMLHttpRequest();
}
// 请求方法,传入URL
function get_virtual_user_list(myURL,myURL2)
{
myreq.open("get",myURL,true);
// 接收的数据交给哪个函数处理
myreq.onreadystatechange = function(){
if (myreq.readyState == 4)
{
// newstr 就是接收到的数据
var newstr = myreq.responseText;
var httpData=JSON.parse(newstr);
reload_Info(httpData,myURL2);
}
};
myreq.send();
}
function getPar(par){
//获取当前URL
var local_url = document.location.href;
local_url = decodeURI(local_url);
//获取要取得的get参数位置
var get = local_url.indexOf(par +"=");
if(get == -1){
return false;
}
//截取字符串
var get_par = local_url.slice(par.length + get + 1);
//判断截取后的字符串是否还有其他get参数
var nextPar = get_par.indexOf("&");
if(nextPar != -1){
get_par = get_par.slice(0, nextPar);
}
return get_par;
}
function search(){
var keywords = $('#keywords').val();
var saleStyle = $('#if_onSale').val();
// var cansee = $('#row').css("display","");
// var cansee1 = $('#two').css("display","");
var myUrl1 = "./st-xm/Api/hotel_list.php?keywords="+keywords+"&saleStyle="+saleStyle+"&pagesize="+pagesize+"&currpage="+aa;
var myUrl2 = "./hotel_list.html?keywords="+keywords+"&saleStyle="+saleStyle;
get_virtual_user_list(myUrl1,myUrl2);
}
function addOneLine(){
}
//复选框选中判断
function select_checked(index) {
//index=0最上面的全选 index=1表示的是下面所有的
var cur_check = $('.ace_check')[0];
var checkList = $('.ace_check');
var checkCount = checkList.length - 1;
var true_count = 0;
for (var i = 1; i < checkList.length; i++) {
if (index == '0') {
checkList[i].checked = cur_check.checked;
} else {
if (checkList[i].checked == false) {
cur_check.checked = false
} else {
true_count = true_count + 1;
}
}
}
//判断下面是否选中完
if (checkCount == true_count) {
cur_check.checked = true;
}
}
//function all_select_checked(sender){
// var checkList = $('.one_ace_check');
// var listCount = checkList.length;
// var allStyle = sender.checked;
// if(allStyle == true){
// for(var i = 0 ; i