2017年5月7日日曜日

開発環境

Head First JavaScript Programming (Eric T. Freeman (著)、Elisabeth Robson (著)、O'Reilly Media)の Chapter 9.(Handling events - Asynchronous Coding)の EXERCISE(No. 6189)を取り組んでみる。

EXERCISE(No. 6189)

コード(Emacs)

HTML5

<pre id="output0"></pre>
<button id="run0">run</button>
<button id="clear0">clear</button>
<script src="sample4.js"></script>

JavaScript

let btn0 = document.querySelector('#run0'),
    btn1 = document.querySelector('#clear0'),
    pre0 = document.querySelector('#output0'),
    p = (x) => pre0.textContent += x + '\n';

window.onresize = () => {
    pre0.textContent += ' that tickles!';
};
let output = () => {
    p("Whatever you do, don't resize this window! I'm warning you!");
};

let clear = () => pre0.textContent = '';

btn0.onclick = output;
btn1.onclick = clear;

output();





    







						

0 コメント:

コメントを投稿

Comments on Google+: