SOURCE

console 命令行工具 X clear

                    
>
console
function drawText(canvas, context, color) {
    context.fillStyle = color;
    context.font = "italic bold 1em sans-serif";
    context.textAlign = "left";
    context.fillText("I saw this tweet", 20, 40);

    context.textAlign = "right";
    context.strokeText("and all I got was this lousy-shirt", canvas.width - 20, canvas.height - 40);

    var tweetsSelection = document.getElementById("tweets");
    var tweet = tweetsSelection[tweetsSelection.selectedIndex].value;
    context.font = "italic 1.2em serif";
    context.textAlign = "left";
    context.fillText(tweet, 40, 100);
}

function updateTweets(tweets) {
    var tweetsSelection = document.getElementById("tweets");
    for (var i = 0; i < tweets.length; i++) {
        var option = document.createElement("option");
        option.text = tweets[i].text;
        option.value = tweets[i].text.replace("\"", "'");
        tweetsSelection.options.add(option);
    }
    tweetsSelection.selectedIndex = 0;
}
updateTweets([{"text": "my first weibo"}, {"text":"second weibo"}])