我试图为Instagram的公共图片生成代码,这些代码按原样输出:http://instagram.com/p/oQX6_5A8B7/
现在我已经有了这个脚本输出100个代码,但它们似乎没有效果,而且我不确定如何改进代码以使它们更有效:
<script language="JavaScript">
var instaURL = 'http://instagram.com/p/o';
var randText = randomString();
function randomString() {
var chars = "-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = 9;
var randomstring = '';
for (var i=0; i<string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
return randomstring;
}
for (var i = 1; i < 1000; i++) {
var output = '<a href="'+instaURL+randomString()+'"/>'+instaURL+randomString()+'</a><br>';
document.write(output);
}
</script>
有没有想过这个?