情報を表示すると同時に、ユーザーがHTMLフォームの入力フィールドにデータを入力できるようにするポップアップ/アラートをJavaScriptで作成するにはどうすればよいですか。
1 に答える
2
HTML:
<p>testingtestingtestingtestingtestingtestingtestingtestingtest ingtestingtestingtestingtestingtestingtestingtestingtestingt
estingtestingtestingtestingtestingtestingt estingtestingtestingtestingtestingtesting</p>
<input
type="button" value="click for popup" onClick="popup()" />
CSS:
#pop
{
width: 200px;
height: 200px;
border: solid 1px #000;
margin-top: -30px;
margin-left: 20px;
position: fixed;
background-color: #fff;
}
Javascript:
window.onload = function () {
var popup = document.createElement("div");
var text = document.createTextNode("blah blah blah");
popup.appendChild(text);
popup.style.visibility = "hidden";
popup.id = "pop";
document.getElementsByTagName("body")[0].appendChild(popup);
};
window.popup = function () {
var pop = document.getElementById("pop");
pop.style.visibility = "visible";
window.setTimeout(function(){document.getElementById("pop").style.visibility="hidden";},1000);
};
于 2013-01-15T04:21:31.297 に答える