Skip to content

Instantly share code, notes, and snippets.

@altnight
Created June 27, 2010 02:06
Show Gist options
  • Save altnight/454551 to your computer and use it in GitHub Desktop.
Save altnight/454551 to your computer and use it in GitHub Desktop.
<html>
<head><title>Lists</title>
</head>
<body>
<div id="list">
<h2>testlist</h2>
<p><span id="mytwitter"></span></p>
</div>
<script type="text/javascript">
<!--
window.onload = function(){
// <script> 要素を動的に作成
var script = document.createElement('script');
script.src = 'http://api.twitter.com/1/statuses/friends_timeline.json?callback=list';
// 読み込み
document.body.appendChild(script);
// 数 ms 後に list({...}) という形でスクリプトが実行される
}
function list(arg) {
var d = document.getElementById("mytwitter");
for (var i = 0,a = arg.length; i<a; i++){
d.textContent = arg[i].user.screen_name;
document.write(d.textContent + "<br/>");
}
}
//-->
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment