目次 |
---|
・クラスを定義する ・匿名オブジェクト ・フォームをサブミットする関数 |
<script language="JavaScript"> <!-- function a(){ var obj = new クラスを定義する(); obj.test1 = 1; obj.test2 = "2"; obj.test3 = new Date(); alert(obj.test1); alert(obj.test2); alert(obj.test3); } // --> </script>
<script language="JavaScript"> <!-- var function SubmitControler(target,successFunc,errorFunc){ this.target = target; this.doSubmit = false; this.successCallBackFunc = successFunc; this.errorCallBackFunc = errorFunc; this.setForm = function(form){ } this.setFormAction = function(action){ this.target.attr("action",action); } /* 同期通信 */ this.Submit = function(event,msg){ if(event){ event.preventDefault(); } if(!msg){ this.multiple this.target.submit(); }else{ if(confirm(msg)){ this.multiple this.target.submit(); } } /* 非同期通信 */ this.exeAjax = function(){ if(event){ event.preventDefault(); } this.multiStart = function{ this.doSubmit = true; $("overlay").show(); $("loading").show(); } $.ajax({ url:this.target.attr("action"); type:this.target.attr("method"); datatype:'json', beforeSend:function(xhr){ xhr.setRequestHandler("If-Modified-Since",SYSDATE); } complete:function(){ completeCallBackHandler(VC); } success:function(data){ successHandler(data,VC); } error: }); } } /* */ function completeCallBackHandler(VC){ VC.mulitEnd(); } // --> </script>