Twitter Like Flash Message with jQuery
フォームにメッセージを入力し、POST送信すると、PHP側で動的に入力値を受け取ってメッセージを表示します。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="ja" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />
<title>設置サンプル</title>
<link rel="stylesheet" href="/content/lib/global.css" type="text/css" />
<!-- JS -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="/content/lib/jquery/jquery.MaxInput.js"></script>
<script type="text/javascript">
$(function(){
setTimeout(function(){
$(".flash").fadeOut("slow",
function(){
$(this).remove();
}
);
},2000);
});
</script>
<!-- CSS -->
<style type="text/css">
body {
background:#ddeef6;
}
#wrap {
position:relative;
}
.flash {
position:absolute;
top:0; left:0;
margin:5px;
padding-top:8px;
padding-bottom:8px;
width:100%;
background-color:#fff;
font-weight:bold;
font-size:20px;
-moz-border-radius:6px;
-webkit-border-radius:6px;
text-align:center;
}
.txt {
border:#000 solid 1px;
width:300px;
font-size:16px;
height:25px;
}
.btn {
background-color:#0060a1;
border:solid 1px #003399;
font-size:16px;
font-weight:bold;
color:#fff;
-moz-border-radius:6px;
-webkit-border-radius:6px;
padding-left:10px;
padding-right:10px;
}
</style>
<link rel="stylesheet" type="text/css" href="/common/css/example.css"></head>
<body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP & JavaScript Room</a> :: 設置サンプル</h1>
<h3 class='h'>実行結果</h3>
<!-- CODE -->
<div id="wrap">
<h1>設置サンプル</h1>
<p><a href='http://www.9lessons.info/2009/03/flash-message-with-jquery.html'>Twitter Like Flash Message with jQuery</a></p>
<p>
フォームにメッセージを入力し、POST送信すると、PHP側で動的に入力値を受け取ってメッセージを表示します。
</p>
<form action="#" method="post">
<label>メッセージを入力してください:</label>
<input type="text" name="message" class="txt" /> <input type="submit" value="送信" class="btn" />
</form>
<!-- CODE / -->
</div>
</body>
</html>