2014年3月25日火曜日

開発環境

Head First JavaScript ―頭とからだで覚えるJavaScriptの基本( Michael Morrison (著), 豊福 剛 (翻訳)、オライリージャパン)の12章(ダイナミックなデータ)、自分で考えてみよう(p.593)を解いてみる。

その他参考書籍

自分で考えてみよう(p.593)

コード(BBEdit)

ajax.js

var entry_date = document.getElementById('entry_date'),
    entry_body = document.getElementById('entry_body'),
    initForm = function () {
        entry_date.value = (new Date()).shortFormat();
        entry_body.focus();
    };

Date.prototype.shortFormat = function () {
    return (this.getMonth() + 1) + '/' + this.getDate() + '/' +
        this.getFullYear();
};
initForm();



0 コメント:

コメントを投稿