- 爱易网页
-
JavaSript
- 无法给span标签赋值,该怎么处理
日期:2014-05-16 浏览次数:20620 次
无法给span标签赋值
<span id="recent_flash_smallPage" class="product_title"></span>
<div class="fl relative pad_1em" id="product_flash_page">
<span id="recent_flash_smallPrev" class="recent_flash_prev" title="Back"></span>
<span id="recent_flash_smallNext" class="recent_flash_next" title="Next"></span>
<ul class="margin_t max_flash_width" id="recent_flash_small">
。。。。
。。。。
</ul>
</div>
function page_go(id,num, c,t,cid){
var Prev = id + "Prev";
var Next = id + "Next";
var pageId = id + "Page";
var Page = 0;
var currentPage = 1;
var PageNumber = Math.ceil(t/num);
var activeClick = true;
var gopage = 0;
if(num>t){activeClick = false;}
if(c >= num){
if(t!=null){
gopage = Math.ceil(c/num);
if(c % num == 0) gopage++;
}
updateProduct('goto', gopage);
}
function updateProduct(type, gopage) {
if(type=='pre') {Page -= parseInt(num);currentPage--};
if(type=='next') {Page += parseInt(num);currentPage++};
if(type=='goto' && gopage != null) {Page = (gopage-1) * num ; currentPage = gopage;}
if(Page<0) {
Page=num*(PageNumber-1);
currentPage=PageNumber;
}
if(Page>=t) {
Page=0;
currentPage=1;
}
$(pageId).innerHTML = currentPage +'/'+PageNumber;
for(i=0;i<num;i++){
if(i >= productPrice.length){
break;
}
n_page = i + Page;
$('cell_price'+i).innerHTML=productPrice[n_page];
$('cell_link'+i).href = rewrite_url(productName[n_page], productID[n_page]);
$('cell_link'+i).title = productName[n_page];
$('li'+i).style.display='block';
if(productID[n_page] == null){
$('li'+i).style.display='none';
continue;
}
if(num==4)$('cell_img'+i).src=baseURL+"images/root/loading_img_b.gif";
if(num==8)$('cell_img'+i).src=baseURL+"images/root/loading_img_s.gif";
$('cell_img'+i).alt=productName[n_page];
$('cell_img'+i).title=productName[n_page];
loadImage('cell_img'+i,imgURL+productIMG[n_page]);
if(cid != null){
if(cid == productID[n_page]){
$('cell_img'+i).className = 'allborder';
}
else{
$('cell_img'+i).className = '';
}
}
if(productSourcePrice != null){
$('cell_source_price'+i).innerHTML=productSourcePrice[n_page];
}
if(productSubName != null && productName != null){
$('cell_name_link'+i).innerHTML=productSubName[n_page];
$('cell_name_link'+i).href=rewrite_url(productName[n_page], productID[n_page]);
$('cell_name_link'+i).title=productName[n_page];
}
if(productFlg != null){
var tmp = productFlg[n_page].split('#');
if(tmp.length < 4) continue;
$('sold_out_s'+i).style.display = (tmp[0] > 0) ? 'block' : 'none';
$('almost_sold_out_s'+i).style.display = (tmp[1] > 0) ? 'block' : 'none';
if(tmp[2] > 0){
$('product_count_s'+i).innerHTML=tmp[2];
}
$('product_count_s'+i).style.display = (tmp[2] > 0) ? 'block' : 'none';
$('sale_item_s'+i).style.display = (tmp[3] > 0) ? 'block' : 'none';
}
}
}
$(pageId).innerHTML = currentPage +'/'+PageNumber;
$(Prev).onclick = function () {
if(!activeClick) return false;
updateProduct('pre');
}
$(Next).onclick = function () {
if(!activeClick) return false;
updateProduct('next');
}
}