日期:2014-05-16 浏览次数:20340 次
<select name="" id="">
for(var i=1; i<=305; i++)
{
document.write('<option value=');
document.write(i);
document.write('>');
document.write(i);
document.write('</option>');
}
for(var i1=402; i<1=861; i1++)
{
document.write('<option value=');
document.write(i1);
document.write('>');
document.write(i1);
document.write('</option>');
}
for(var i2=1004; i<=1658; i2++)
{
document.write('<option value=');
document.write(i2);
document.write('>');
document.write(i2);
document.write('</option>');
}
</scelect>
var htmls = [];
var data = [[1, 305], [402, 861], [1004, 1658]];
var l, t, s, e;
l = data.length;
htmls.push('<select name="" id="">');
for(var i = 0; i < l; i++) {
t = data[i];
s = t[0];
e = t[1];
for(var j = s; j <= e; j++) {
htmls.push('<option value="'+ j +'">'+ j +'</option>');
}
}
htmls.push('</select>');
document.getElementById('id').innerHTML = htmls.join('');