日期:2014-05-16 浏览次数:20440 次
// sample code
var $input, $output;
// notice the semi-colon at the END of function declarations
onload = function() {
    $input = document.getElementById("input");
    $output = document.getElementById("output");
    _clearAll(true);
};
function _packScript() {
    $output.value = pack($input.value);
};
function _clearAll($focus) {
    $output.value = $input.value = "";
    // the "if" statement is NOT terminated with a semi-colon
    if ($focus) {
        $input.focus();
    }
};