编号前加0问题错在哪儿VBScript code%for i1 to 10if i10 thenif i10 thenProdId0&(i)elseProdId(
编号前加0问题错在哪儿
VBScript code
<%for i=1 to 10 if i<10 then if i<10 then ProdId="0"&(i) else ProdId=(i) end if elseif i<100 then if i<10 then ProdId="00"&(i) elseif i<100 then ProdId="0"&(i) else ProdId=(i) end if elseif i<1000 then if i<10 then ProdId="000"&(i) elseif i<100 then ProdId="00"&(i) elseif i<100 then ProdId="0"&(i) else ProdId=(i) end if else ProdId=(i) end ifresponse.write ProdId &"<br>"next%>
[解决办法] <% dim intnum intnum=101 for i=1 to intnum if intnum<=10 then
ProdId=(i)
elseif intnum<=100 and intnum>10 then if i<10 then ProdId="00"&(i) elseif i<100 then ProdId="0"&(i) else ProdId=(i) end if elseif intnum<=1000 and intnum>100 then if i<10 then ProdId="000"&(i) elseif i<100 then ProdId="00"&(i) elseif i<1000 then ProdId="0"&(i) else ProdId=(i) end if else ProdId=(i) end if response.write ProdId &"<br>" next %>