yo lo hice asi pero tu código es super preciso, mira este era mi código:
Código Javascript
:
Ver original<script type="text/javascript">
valor_array = 29;
var miArray = new Array(valor_array)
miArray[0] = "http://www.desarrolloweb.com/DW1024/images/logo.png"
miArray[1] = "http://www.google.com/cse/intl/en/images/google_custom_search_watermark.gif"
miArray[2] = "http://www.desarrolloweb.com/images/iconos/user.png"
miArray[3] = "http://www.desarrolloweb.com/images/centralfondoup3.gif"
miArray[4] = "http://www.desarrolloweb.com/images/centralfondomedio7.gif"
miArray[5] = "http://www.desarrolloweb.com/images/f-cuerpo1.gif"
miArray[6] = "http://akamai.smartadserver.com/diff/159/681962/Unified_Communication_6_728x90.swf"
miArray[7] = "http://view.atdmt.com/MSA/view/214220287/direct/01/"
miArray[8] = "http://adserver2.desarrolloweb.com/openx/www/delivery/lg.php?bannerid=171&campaignid=158&zoneid=18&channel_ids=,&OASCAP=15&OASCCAP=15&loc=http%3A%2F%2Fwww.desarrolloweb.com%2Farticulos%2F630.php&referer=http%3A%2F%2Fwww.google.cl%2Furl%3Fsa%3Dt%26source%3Dweb%26ct%3Dres%26cd%3D1%26ved%3D0CAYQFjAA%26url%3Dhttp%3A%2F%2Fwww.desarrolloweb.com%2Farticulos%2F630.php%26rct%3Dj%26q%3Darray+javascript%26ei%3D4H6rS9mXAoaglAfTq7CYDg%26usg%3DAFQjCNGhuHhCYGg05Didl4czsPpepYww9w&cb=93b7005fd4"
miArray[9] = "http://www.desarrolloweb.com/images/tit728verdecentro.gif"
miArray[10] = "http://www.desarrolloweb.com/images/tit728verdeup.gif"
miArray[11] = "http://www.desarrolloweb.com/images/tit728verdedw.gif"
miArray[12] = "http://www.desarrolloweb.com/images/iconos/award_star_gold_2.png"
miArray[13] = "http://www.desarrolloweb.com/images/votos/cero.png"
miArray[14] = "http://www.desarrolloweb.com/images/iconos/comment_add.png"
miArray[15] = "http://www.desarrolloweb.com/images/iconos/comment.png"
miArray[16] = "http://akamai.smartadserver.com/diff/159/658743/300x250.swf"
miArray[17] = "http://www.desarrolloweb.com/images/c728titmdveve.gif"
miArray[18] = "http://www.desarrolloweb.com/images/c728titupveve.gif"
miArray[19] = "http://www.desarrolloweb.com/images/c728titdwveve2.gif"
miArray[20] = "http://www.desarrolloweb.com/images/c728cuemdve.gif"
miArray[21] = "http://www.desarrolloweb.com/images/c728cuedwve.gif"
miArray[22] = "http://www.desarrolloweb.com/images/atras.png"
miArray[23] = "http://www.desarrolloweb.com/images/delante.png"
miArray[24] = "http://www.desarrolloweb.com/images/c728titmdazbl.gif"
miArray[25] = "http://www.desarrolloweb.com/images/c728titupazbl.gif"
miArray[26] = "http://www.desarrolloweb.com/images/c728titdwazbl.gif"
miArray[27] = "http://www.desarrolloweb.com/images/caja728cuerpocentro.gif"
miArray[28] = "http://www.desarrolloweb.com/images/caja728cuerpodw.gif"
for (i = 0; i < valor_array ; i++)
{
var str = miArray[i];
total = str.length;
resultado = total - 4;
nun1 = resultado;
nun2 = total;
salida = str.substring(nun1, nun2);
if (salida == ".jpg")
{
document.write(str + "<br>");
}
else if (salida == ".png")
{
document.write(str + "<br>");
}
/*
else if (salida == ".gif")
{
document.write(str + "<br>");
}
*/
}
</script>
Como le hago para que se enumeren ordenadamente, así:
1, 2, 3 ,4 ,5, 6 ...etc
Ya que su salida es igual a la del arreglo:
1 [url]http://www.google.com/cse/intl/en/images/google_custom_search_watermark.gif[/url]
3 [url]http://www.desarrolloweb.com/images/centralfondoup3.gif[/url]
4 [url]http://www.desarrolloweb.com/images/centralfondomedio7.gif[/url]
5 [url]http://www.desarrolloweb.com/images/f-cuerpo1.gif[/url]
9 [url]http://www.desarrolloweb.com/images/tit728verdecentro.gif[/url]
etc...