[新着] Webテンプレートを仮オープンしました
var from = document.from.value ;
var to = document.to.value ;
var check = from + 10000;
if(check < to){alert("検索期間は1年以内で入力してください");}var from = document.from.value ;
var to = document.to.value ;
var check = to - from;
if(check > 10000){alert("検索期間は1年以内で入力してください");}// JavaScript 2.0
var from:Integer = Integer (document.forms.item (0).elements.namedItem ('from').value);<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<meta http-equiv="Content-Language" content="ja">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
window.onload = function() {
document.from = document.getElementById("from");
document.to = document.getElementById("to");
}
function check() {
var from = document.from.value ;
var to = document.to.value ;
var check = to - from;
if(check > 10000){alert("検索期間は1年以内で入力してください");}
}
</script>
<title>non-title</title>
</head>
<body>
<div>
<input type="text" id="from" value="">
<input type="text" id="to" value="">
<input type="button" value="check" onclick="check()">
</div>
</body>
</html><form action="#">
<p><input name="test1"></p>
<p>
<!-- IE:OK, Fx:OK, Op:OK, Sa:OK -->
<input type="button" value="BUTTON" onclick="alert (test1); ">
<!-- IE:OK, Fx:OK, Op:NG, Sa:NG -->
<input type="button" value="BUTTON" onclick="alert (document.test1); ">
</p>
</form><form action="#"> <p><input name="test1"></p> </form> <p> <!-- IE:NG, Fx:NG, Op:NG, Sa:NG --> <input type="button" value="BUTTON" onclick="alert (test1); "> <!-- IE:NG, Fx:NG, Op:NG, Sa:NG --> <input type="button" value="BUTTON" onclick="alert (document.test1); "> </p>
<script type="text/javascript" for="button" event="click()"> alert (test1); // [object] alert (document.test1); // undefined </script> <form action="#"> <p><input name="test1"></p> <p><input type="button" value="BUTTON" id="button"></p> </form>
<p><input type="button" value="BUTTON" id="button"></p> <form action="#"> <p><input name="test1"></p> <script type="text/javascript" for="button" event="click()"> alert (test1); // Error alert (document.test1); // undefined </script> </form>