我有一个脚本,按订单把网址变成一个iframe中:阅读TXT文件中的数据转换为JavaScript阵列
<script type="text/javascript">
$(document).ready(function(){
var array = ['http://www.example1.come', 'http://www.example2.com', 'http://www.example3.com'];
var beforeLoad = (new Date()).getTime();
var loadTimes = [];
$('#1').on('load', function() {
loadTimes.push((new Date()).getTime());
$('#1').attr('src', array.pop());
if (array.length === 0) {
$.each(loadTimes, function(index, value) {
$("#loadingtime"+index).html(value - beforeLoad);
});
}
}).attr('src', array.pop());
});
</script>
我得到的URL列表txt文件。该文件中的URL被写入一列(1列,每行从新行开始)。我如何可以替换JavaScript中的'var数组'与该txt文件的内容?
+1占所有不同的可能行尾。 – 2013-02-24 20:19:12