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
<script type="text/javascript"><!-- | |
function myCheck(){ | |
myCnt = 0; // チェックした数 | |
for ( i=0; i<document.myForm.length-1; i++ ){ // チェックボックスの数分ループ | |
if ( document.myForm.elements[i].checked == true ){ // チェックはオンか? | |
myCnt++; // チェック数 加算 | |
} | |
} | |
if ( myCnt == 0 ) myMess = "正常"; // チェックは 無し(ゼロ) | |
else if ( myCnt <= 2 ) myMess = "ちょヤバ"; // チェックは 1以上2以下 |
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
/*HTML1*/ | |
<a href="リンク先のURL" target="_blank">アンカーテキスト</a> | |
/*HTML2*/ | |
<a href="リンク先のURL"><img src="画像のファイル名(保存場所)" alt="画像の説明文"></a> | |
/*javascript*/ | |
<form> | |
ここは、おすすめ! → | |
<input type="button" value="Home Page" onclick="window.open('http://www.netshop.okinawa/')"> | |
</form> |
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
<script type="text/javascript"><!-- | |
myMes = new Array( // あいさつ文の設定 | |
"A HAPPY NEW YEAR!", | |
"謹賀新年", | |
"あけましておめでとうございます", | |
"今年もよろしくお願いします" | |
); | |
myRnd = Math.floor( Math.random() * myMes.length ); // 0~(myMes.length-1)の乱数を求める | |
document.write( myMes[myRnd] ); // あいさつ文を表示する | |
// --></script> |
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
<script type="text/javascript"><!-- | |
myFlg = 0; | |
function myFunc(){ | |
if (myFlg == 0){ | |
document.myForm.myFormMes.value = "いらっしゃいませ!"; | |
myFlg = 1; | |
}else{ | |
document.myForm.myFormMes.value = ""; | |
myFlg = 0; | |
} |
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
<script type="text/javascript"><!-- | |
function myGo(){ | |
mySelect = document.myForm.myMenu.selectedIndex; | |
location.href = document.myForm.myMenu.options[mySelect].value; | |
} | |
// --></script> | |
<form name="myForm"> | |
<select name="myMenu"> | |
<option value="http://#/">☆☆ HTML JavaScript講座 目次 ☆☆ |
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
<form> | |
<input type="button" value="戻る" onclick="history.back()"> | |
<input type="button" value="更新" onclick="location.reload(true)"> | |
<input type="button" value="進む" onclick="history.forward()"> | |
<input type="button" value="トップページへ" onclick="location.href='#'"> | |
</form> |
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
<script type="text/javascript"><!-- | |
myTbl = new Array( // 行事テーブル(月,日,メッセージ) | |
1, 1,"元旦", | |
1,14,"成人の日", | |
2,11,"建国記念の日", | |
4,29,"みどりの日", | |
5, 3,"憲法記念日", | |
5, 4,"国民の日", | |
7,20,"海の日", | |
9,15,"敬老の日", |
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
<script type="text/javascript"><!-- | |
function myFunc(){ | |
myD = new Date(); // 現在時刻 取得 | |
myYear = myD.getFullYear(); // 今年の '年' | |
myNextYear = new Date( myYear+1 , 0 , 1 ); // 来年の1月1日の経過秒を取得 | |
myMsec = myNextYear.getTime() - myD.getTime(); // 来年1月1日 と現在の差(ミリ秒) | |
myNextDay = Math.floor ( myMsec / (1000*60*60*24) ); // '日' を計算 | |
myMsec -= ( myNextDay * (1000*60*60*24) ); // 経過秒から '日' を引く | |
myNextHour = Math.floor ( myMsec / (1000*60*60) ); // '時' を計算 | |
myMsec -= ( myNextHour * (1000*60*60) ); // 経過秒から '時' を引く |
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
<script type="text/javascript"><!-- | |
myQA = new Array( // 問題テーブル | |
"飛行機" , "plane", | |
"船" , "ship", | |
"汽車" , "train", | |
"車" , "car", | |
"自転車" , "bicycle", | |
"川" , "river", | |
"山" , "mountain", | |
"道路" , "road", |
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
ミニロトを乱数アルゴリズムで予想する<BR><BR> | |
こんなの でましたぁ~ → | |
<script type="text/javascript"><!-- | |
myData = new Array(31); | |
for (i=0; i<31; i++) myData[i] = i+1; // myData[0~30] に 1~31を順次セット | |
for (i=0; i<500; i++){ // 500回 myData の内容をシャッフルする | |
myA = Math.floor( Math.random() * 31 ); // 0~30 を決める | |
myB = Math.floor( Math.random() * 31 ); // 0~30 を決める | |
myBackup = myData[myA]; // myData の myA番目とmyB番目の内容を入れ替える | |
myData[myA] = myData[myB]; |