forked from boxp/html-lecture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
31 lines (25 loc) · 899 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"use strict";
function post(){
//dom作成
var textv = document.createElement("div");
document.body.appendChild(textv);
textv.removeAttribute("style");
textv.style.position = "fixed";
textv.style.transition = "all 2s";
textv.style.top = "0px";
textv.style.fontSize = "6em";
/* ブラウザのサイズを取得 */
var height = document.documentElement.clientHeight;
var width = document.documentElement.clientWidth;
//テキストフィールドからテキストを取得
//var text = document.getElementById("input-form").value;
var text = document.getElementsByName("input-form")[0].value;
//domの生成、配置
textv.textContent = text;
textv.style.left = width * Math.random() + "px";
//domを上から落とす
textv.style.top = height + 200 + "px";
//domを消す
setTimeout(function(){document.body.removeChild(textv);},2000)
return 0;
};