⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 18-11.txt

📁 《HTML开发王》源代码打开?禜TML开发王》源代码打开《HTML开发王》源代码打开
💻 TXT
字号:
//该函数用来写一个div块
function writeSub(absURL, product_id, pic_id, product_price, product_name){
  document.write('<td valign="top" style="border:solid #cccccc;border-width: 1px;">');
  document.write('<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">');
  document.write('<tr>');
  document.write('<td width="8" height="5"></td>');
  document.write('<td width="104"></td>');
  document.write('<td width="8"></td>');
  document.write('</tr>');
  document.write('<tr>');
  document.write('<td height="77"></td>');
  document.write('<td align="center" style="border:solid #cccccc;border-width: 1px;">');
  document.write('<a href="' + absURL + '/ysf_html/content/product/product_detail/' + product_id + '" >');
  document.write('<img src="' + absURL + '/ysf_html/content/product/imgs/' + pic_id + '" width="98" height="72" border="0" />');
  document.write('</a><td></td>');
  document.write('</tr>');
  document.write('<tr>');
  document.write('<td height="75"></td>');
  document.write('<td align="center">'); 
  document.write('<br />¥' + product_price );
  document.write('<br />' + product_name);
  document.write('<br /><br />');  
  document.write('<a href="' + absURL + '/ysf_html/content/product/product_detail/' + product_id + '" >');
  document.write('<img src="' + absURL + '/ysf_html/shared/imgs/btn_more.gif" width="80" height="20" border="0" align="absbottom"/>');
  document.write('</a></td>');
  document.write('<td></td>');
  document.write('</tr>');
  document.write('<tr>');
  document.write('<td height="5"></td>');
  document.write('<td></td>');
  document.write('<td></td>');
  document.write('</tr>');
  document.write('</table>');
  document.write('</td>');
  document.write('<td></td>');
}
function writePage(listPage,where){
  //初始化开始索引和结束索引
  var listFrom = 10000;
  var listTo = 9999;
  //检测该页是否包含数据
  if((12*(listPage-1))>product_list_arr.length){ return; } 
  //计算一页的开始索引和结束索引
  listFrom = (listPage-1)*12;
  listTo = listFrom+12-1; 
  if(where=="top"){
	listTo = listFrom + 6 -1;
    //如果最后一页达不到6个产品
    if((6*listPage)>product_list_arr.length){
      listTo = product_list_arr.length-1;
    }	  
  }
  if(where=="bottom"){
	if((12*(listPage-1)+6)>product_list_arr.length){ return; }
	listFrom = listFrom + 6;
	listTo = listFrom + 6 - 1;
    //如果最后一页达不到12个产品
    if((12*listPage)>product_list_arr.length){
      listTo = product_list_arr.length-1;
    }	  
  }  
  //遍历所有产品,调用writeSub函数
  for (var i=listFrom; i<=listTo; i++){
    writeSub("http://localhost", product_list_arr[i][0], product_list_arr[i][1], product_list_arr[i][2],product_list_arr[i][3]);
  }
}
//产品数据库,使用一个二维数组来提供
var product_list_arr = new Array();
product_list_arr[0] = ["product_0001.html","pic0104.jpg",2.5,"康师傅冰红茶"];
product_list_arr[1] = ["product_0002.html","pic0002.jpg", 10,"洋葱牛肉煲"];
product_list_arr[2] = ["product_0003.html","pic0003.jpg",8,"糯米烧卖"];
product_list_arr[3] = ["product_0004.html","pic0004.jpg",22,"西兰花牛柳"];
product_list_arr[4] = ["product_0005.html","pic0005.jpg",10,"芥末鸭掌"];
product_list_arr[5] = ["product_0006.html","pic0006.jpg",10,"宫保鸡丁"];
product_list_arr[6] = ["product_0007.html","pic0001.jpg",31.5,"水晶虾仁"];
product_list_arr[7] = ["product_0008.html","noProductPic.gif",25,"宋嫂鱼羹"];
product_list_arr[8] = ["product_0009.html","noProductPic.gif",10,"asd"];
product_list_arr[9] = ["product_0010.html","noProductPic.gif",20,"香菇子鸡煲"];
product_list_arr[10] = ["product_0011.html","noProductPic.gif",12,"尖椒牛柳"];
product_list_arr[11] = ["product_0012.html","noProductPic.gif",11,"鱼香茄子煲"];
product_list_arr[12] = ["product_0013.html","noProductPic.gif",10,"鸳鸯瓜球"];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -