<%
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 if
response.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 %>