×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
やりたいこと
- 押すボタンを押すとConsoleに "こんにちWorld!" と表示する
必要なもの
# apt-get install chromium
または
# apt-get install iceweasel
hello_js.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Hello World</title>
<style type="text/css">
body {
width: 200px;
height: 100px;
}
button {
width: 190px;
height: 50px;
}
</style>
</head>
<body>
<button id="hello_button">押す</button>
</body>
<script type="text/javascript">
var hello_button = document.getElementById('hello_button');
hello_button.onclick = function(){
console.log("こんにちWorld!");
}
</script>
</html>
<!-- version 20140121 -->
実行方法
chromium-31の場合
- hello_js.htmlを読み込む
- Tools → JavaScript Console (Ctrl+Shift+j)
iceweasel-24の場合
- hello_js.htmlを読み込む
- Tools → Web Developer → Web Console (Ctrl+Shift+k)
PR
コメント