クリックで、次年度にしたり、前年度にしたりする。
↑ で、次年度
↓ で、前年度
とした。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<script type="text/javascript" src="../jquery/jquery.js"></script> | |
<script> | |
$(function(){ | |
//引く | |
$("#DWN").click(function() { | |
var date = new Date(); | |
var yr = date.getFullYear(); | |
//データ無し | |
if($("#YR").val()==""){ | |
$("#YR").val(yr); | |
$("#msg").html("<font color=green>今年を代入しました。</font>"); | |
} | |
//データ有り | |
else{ | |
var text = $("#YR").val()-1; | |
$("#YR").val(text); | |
$("#msg").html("<font color=red>前年度にセットしました。</font>"); | |
} | |
}); | |
//足す | |
$("#UPP").click(function() { | |
var date = new Date(); | |
var yr = date.getFullYear(); | |
//データ無し | |
if($("#YR").val()==""){ | |
$("#YR").val(yr); | |
$("#msg").html("<font color=green>今年を代入しました。</font>"); | |
} | |
//データ有り | |
else{ | |
var txu = parseInt($("#YR").val())+1; | |
$("#YR").val(txu); | |
$("#msg").html("<font color=red>次年度にセットしました。</font>"); | |
} | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>SET YEAR</h1> | |
年度をクリック操作。<br><br> | |
<input type="text" size="5" name="year" id="YR" value="2016">yyyy <small><span id="DWN"> ↓↓ </span> <span id="UPP"> ↑↑ </span> | |
<br> | |
<div id="qmsg"> | |
</div> | |
</body> | |
</html> |
少しは入力の手間が省けるだろうか。
0 件のコメント:
コメントを投稿