JavaScriptの例

Dateのオブジェクト:

<html>
<head>
<title>Date Object Example</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
days=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
today=new Date
document.write("Today is "+days[today.getDay()]);
</script>
</body>
</head>
</html>

 

日付のチェック:

<html>
<head>
<title>Validation Program</title>
<script type="text/javascript">
function validateNumber(tForm){
    if(tForm.result.value !=5){
        this.alert ("Not 5!");
    }else{
        this.alert("Correct.Good Job!");
    }
}
</script>
</head>
<body>
<hr>
<p>
<h1>Validate</h1>
<form name="form">
<input type="text" name="result" value="0" SIZE="2">
<input type="button" value="Validate" name="calcButton"
onClick="validateNumber(this.form)">
</form>
<hr>
</body>
</html>

失敗の例:

<html>
<head>
<title>Slider</title>
</head>
<body>

<object classid="clsid:F08DF954-8592-11D1-B16A-00C0F0283628" id="Slider1" width="100" height="50">
<param name="BorderStyle" value="1"/>
<param name="MousePointer" value="0"/>
<param name="Enabled" value="1"/>
<param name="Min" value="0"/>
<param name="Max" value="10"/>
</object>

</body>
</html>

posted @ 2014-07-31 15:59  塔斯曼  阅读(101)  评论(0编辑  收藏  举报