12.
下の例ではIE5以上の時とそれ以外という条件で判定しています。 <html> <head> <title>Auto selection</title> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"/> <script> <!-- function trans(){ if ((navigator.appName =="Microsoft Internet Explorer") && navigator.appVersion.indexOf("5.0",0) > 0) location.replace("ie5.htm"); else location.replace("Netscape.htm"); } --> </script> </head> <body onload="trans()"> </body> </html> |
Netscape Navigator の場合、URL 欄に javascript: と打つとデバッグ用のウィンドウが表示されます。 |
<HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- function unload(){ alert( "もう終わりですか?" ); } //--> </SCRIPT> </HEAD> <BODY onUnload="unload()"> |
<FORM> <INPUT TYPE="BUTTON" VALUE="三つ前へ戻る" onClick=history.go(-3);> <INPUT TYPE="BUTTON" VALUE="二つ前へ戻る" onClick=history.go(-2);> <INPUT TYPE="BUTTON" VALUE="一つ前へ戻る" onClick=history.go(-1);> <INPUT TYPE="BUTTON" VALUE="一つ先へ進む" onClick=history.go(1);> <INPUT TYPE="BUTTON" VALUE="二つ先へ進む" onClick=history.go(2);> <INPUT TYPE="BUTTON" VALUE="三つ先へ進む" onClick=history.go(3);> </FORM> |
7.Server Side Javascriptでのトランザクション
明示的にトランザクションの開始・終了を宣言する事でトランザクション処理は実行可能ですが、HTMLページをまたがったトランザクションは実行出来ません。利用するメソッドは下記の通りです。 beginTransaction commitTransaction rollbackTransaction |
6. Server Side Javascript の webファイルとは
webファイルは、サーバサイドJavascriptを含むHTMLファイルをサーバ側で解釈・実行が高速で行えるように、jsac(JavaScript Application Compiler)というツールで中間コードに変換されたファイルのことです。 |
<SCRIPT LANGUAGE="JavaScript"> document.write("あなたのブラウザは<BR>"); document.write("Version:", navigator.appVersion, "<BR>"); document.write("Name:", navigator.appName, "<BR>"); document.write("Codename:", navigator.appCodeName, "<BR>"); document.write("UserAgent:", navigator.userAgent, "<BR>"); </SCRIPT> |
ボタンをSUBMITにせずTYEP="BUTTON"にします。 <FORM NAME="Frm_test" METHOD="POST" ACTION="test.asp"> : : <INPUT TYPE="BUTTON" VALUE="testへ" ONCLICK="submit();"> <INPUT TYPE="BUTTON" VALUE="test2へ" ONCLICK="action='test2.asp'; submit();"> <INPUT TYPE="BUTTON" VALUE="test3へ" ONCLICK="action='test3.asp'; submit();"> </FORM> |
<A HREF="javascript:newWindow('xxxx.html')">xxxx</A> |
<HTML> <HEAD> <TITLE></TITLE> </HEAD> <BODY> <SCRIPT Language="JavaScript"> <!--------------------------------------------------- if(navigator.appVersion.charAt(0) >= 4 &&navigator.appName.charAt(0)=="N") { window.onerror=null; var LocHost =java.net.InetAddress.getLocalHost(); var hostName =LocHost.getHostName(); var ipAdd =LocHost.getHostAddress(); document.write("LocalHost:<font color=red>"+LocHost+ "</font><br>"); document.write("Host Name:<font color=red>"+hostName+ "</font><br>"); document.write("IP:<font color=red>" +ipAdd+"</font><br>"); } //----------------------------------------------------> </SCRIPT> </BODY> </HTML> |
<SCRIPT LANGUAGE="JavaScript"> <!-- dd = new Date(); yyyy = dd.getFullYear(); yyyy = yyyy.toString(); mm = dd.getMonth() + 1; mm = mm.toString(); if (mm.length == 1) { mm = 0 + mm;} dd = dd.getDate(); dd = dd.toString(); document.write(yyyy+mm+dd); // --> </SCRIPT> |
前ページに戻る---> RETURN