Created
June 27, 2010 02:06
-
-
Save altnight/454551 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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