作者 主題: nav+iframe實例  (閱讀 1279 次)

0 會員 與 1 訪客 正在閱讀本文。

tonyvan123

  • 活潑的大學生
  • ***
  • 文章數: 447
    • 檢視個人資料
nav+iframe實例
« 於: 2014-12-04 15:36 »
                         
                           <!DOCTYPE html>
<Html>
<Head>
<Title>RAM登錄</Title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<LINK rel=stylesheet type="text/css" href="/syn/fun/style.css">

<script language="JavaScript">
<!--
  var errfound = false;
  var xmlHttp;
  var iSetProductMode = document.getElementById('SetProductMode');
   var iSetDPY = document.getElementById('SetDPY');
 
   function ValidateNumber(e) { 
       var key;
       if(window.event) {
           key = e.keyCode;
       }else if(e.which) {
           key = e.which;
       } else {
           return true;
       }
       if(8==key || 46==key){//8:backspace 46:delete (倒退鍵和刪除鍵也允許作用)
           return true;
       }
       var keychar = String.fromCharCode(key);
       var reg = /\d/;
       return reg.test(keychar);
   };

  function FieldLength(item,len) {
    if (item.value.length > len - 1 ) return false;
     else return true;
  };
 
  function ValidLength(item, len) {
      return (item.length >= len);
  }

  function MatchLength(item, len) {
      document.frmMobile.msg.value = item.length;
      return (item.length == len);
  }

  function ShowMsg(elem, text){
      window.alert(text);
      elem.select();
      elem.focus();
      errfound = true;
     
  }
       
  function IsNull( val ) {
     var isValid = false;
 
     if (val+"" == "null")
        isValid = true;
 
     return isValid;
  }
 
  function IsUndef( val ) {
     var isValid = false;
 
     if (val+"" == "undefined")
        isValid = true;
 
     return isValid;
  }
 
  function IsBlank( str ) {
     var isValid = false;
 
     if ( IsNull(str) || IsUndef(str) || (str+"" == "") )
        isValid = true;
 
     return isValid;
  }
 
  function IsAlpha( str ) {
     if (str+"" == "undefined" || str+"" == "null" || str+"" == "")
        return false;
 
     var isValid = true;
 
     str += "";
 
     for (i = 0; i < str.length; i++) {
        if ( !( ((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
           ((str.charAt(i) >= "A") && (str.charAt(i) <= "Z")) ) ) {
                 isValid = false;
                 break;
           }
     }
     return isValid;
  }
 
  function IsAlphaNum( str ) {
     if (str+"" == "undefined" || str+"" == "null" || str+"" == "")
        return false;
 
     var isValid = true;
     str += "";
 
     for (i = 0; i < str.length; i++) {
     if (!(((str.charAt(i) >= "0") && (str.charAt(i) <= "9")) ||
           ((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
           ((str.charAt(i) >= "A") && (str.charAt(i) <= "Z"))))
           {
              isValid = false;
              break;
           }
     }
     return isValid;
  }
 
  function IsValidEmail( str ) {
     if (str+"" == "undefined" || str+"" == "null" || str+"" == "")
        return false;
 
     var isValid = true;
 
     str += "";
 
     namestr = str.substring(0, str.indexOf("@"));
     domainstr = str.substring(str.indexOf("@")+1, str.length);
 
     if (IsBlank(str) || (namestr.length == 0) ||
           (domainstr.indexOf(".") <= 0) ||
           (domainstr.indexOf("@") != -1) ||
           !IsAlpha(str.charAt(str.length-1)))
        isValid = false;
 
     return isValid;
  }

 
  function jsSetProductMode(iPtype)
  {
      var selectedValue = iPtype.options[iPtype.selectedIndex].value;
      var iMODE=document.getElementById("SetProductMode");
      document.frmMobile.query.value="SetProductMode"; 
      iMODE.src="SonyMobileSetModeDPY1.php"+"?KIND="+selectedValue;
    checkModeLoaded();
  }

   function checkModeLoaded() {
      iSetProductMode = document.getElementById('SetProductMode');
      var iSetProductModeDoc = iSetProductMode.contentDocument || iSetProductMode.contentWindow.document;
      
      if (  iSetProductModeDoc.readyState  == 'complete' ) {
         iSetProductMode.contentWindow.onload = function(){
         };
         
         document.getElementById('txtMode').value=iSetProductModeDoc.getElementById('ProductMode').value;
         jsSetDPY();
         return;
      }
      
      window.setTimeout('checkModeLoaded();', 50);
   }
                              
   function jsSetDPY() {
      var iKIND=document.getElementById("ProductKind");
      var iSetMode = document.getElementById('SetProductMode');
      var iMODE=iSetMode.contentDocument.getElementById("ProductMode");
      var selectedValue = iMODE.options[iMODE.selectedIndex].value;
      var iSetDPY=document.getElementById("SetDPY");
      var iDPY=iSetDPY.contentDocument.getElementById("DPY");
      var iKINDval=iKIND.options[iKIND.selectedIndex].value;
      var iMODEval=iMODE.options[iMODE.selectedIndex].value;
      document.frmMobile.query.value="SetDPY";       

      if (iKINDval=='手機' || iKINDval=='DOA' || iKINDval=='機板') {
         iDPY.disabled="";
         iDPY.src="SonyMobileSetDPY1.php"+"?KIND="+iKINDval+"?MODE="+iMODEval; 
          checkDPY_Loaded();
      } else {
          iDPY.disabled="disabled";    
      };


   };
               
   function checkDPY_Loaded() {
      iSetDPY = document.getElementById('SetDPY');
      var iSetDPYDoc = iSetDPY.contentDocument || iSetDPY.contentWindow.document;
      
      if (  iSetDPYDoc.readyState  == 'complete' ) {
         iSetDPY.contentWindow.onload = function(){
            alert("DPY is loaded");
         };
         
         var iDPY=iSetDPYDoc.getElementById("DPY");
         document.getElementById('txtDPY').value=iDPY.value;
         return;
      }
      
      window.setTimeout('checkDPY_Loaded();', 50);
   }
                           
  function getChildDPY()
  {
      var iPRG = document.getElementById('SetDPY');
      var iDPY=iPRG.contentDocument.getElementById("DPY");
      var selectedValue = iDPY.options[iDPY.selectedIndex].value;
  }


   function jsSubmit()
   {
      var num=document.frmMobile.quantity.value; 

      if ( num < 1 ) {
         errfound = true;
         ShowMsg(document.frmMobile.quantity, '數量不能小於 1 !');
      }
      
      if (errfound==true) {
         document.frmMobile.query.value="error-found";
      } else {
         document.frmMobile.query.value="submit";
      };
   }
 

   function AlertMsg()
   {
      var msg1="送修時請勿將附配件一起送修\n";
      var msg2="若需附上配件一起檢測時,請在備註欄位加註說明\n";
      var msg3="55機種,送修時請將背蓋一起送修,以利防水檢測\n"; 
      var iNUM=document.getElementById('txtNUM');
      if ( parseInt(iNUM.value)==0)   {
         window.alert(msg1+msg2+msg3); 
      };
      
      checkModeLoaded();
   }
         
   function Validate()   
   { 
       } 

  //-->
</script>
</Head>
<body bgcolor="#ffffff" OnLoad="AlertMsg();">
     
 
   <form onSubmit="return Validate();" method="post" name="frmMobile" target="_self" id="frmMobile" width="100%">
     <table width="100%" border="0" name="mainTable" id="mainTable">
        <tr>
           <td width="16%" height="14">&nbsp;</td>
           <td height="14" bgcolor="#ffffff">
              <div align="center"><IMG height=22  width=106 src=https://www.synvision.com.tw/agent/callfix/images/service_regist_title.gif ><br>
              </div>
               <hr>
              <center>
                 <font color="#400080" size="2"><font color="#ff0000"></font></font> <font color="#400080" size="2">:
                 </font>
              </center>
           </td>
           <td width="15%" height="14px">
           </td>
        </tr>
        <tr>
           <td width="16%" height="286"> </td>
           <td height="286" bgcolor="#004080">
              <table width="100%" border="0" height="257" align="center">
                 <tr>
                    <td width="30%" height="30px" bgcolor="#99cccc" align="right"><font face="新細明體" size="2" color="#333333">
                      商品名稱:</font>
                    </td>
                    <td width="68%" height="30px" bgcolor="#cccccc">
                       <select id="ProductKind" name="ProductKind" STYLE='BACKGROUND-COLOR:#44FFFF' onChange='javascript: jsSetProductMode(this);'>
                          <option value=手機 selected='selected'>手機</option>  <option value=DOA>DOA</option>  <option value=機板>機板</option>  <option value=配件>配件</option>  <option value=藍芽>藍芽</option>                       </select>   
                       <font size="2" color="#ff0000">*</font>       
                     </td>
                 </tr>    
                 <tr>
                   <td width="30%" height="30px" bgcolor="#99cccc" align="right"><font face="新細明體" size="2" color="#333333">機型:</font></td>
                   <td width="68%" height="30px" bgcolor="#cccccc"> 
                          <iframe name="SetProductMode" id="SetProductMode" frameborder="0" scrolling=no height="30px" width="100%"   
                              src="SonyMobileSetModeDPY1.php">
                          </iframe> 
                     </td>     
                 </tr>
                 <tr>
                    <td width="30%" height="30px" bgcolor="#99cccc" align="right"><font face="新細明體" size="2" color="#333333">DPY No:</font></td>
                    <td width="68%" height="30px" bgcolor="#cccccc" align="left">   
                          <iframe name="SetDPY" id="SetDPY" frameborder="0" scrolling=no height="30px" width="100%"   
                              src="SonyMobileSetDPY1.php">
                          </iframe> 
                     </td>     
                 </tr>
                 <tr>
                   <td width="30%" height="30px" bgcolor="#99cccc" align="right"><font face="新細明體" size="2" color="#333333">數量:</font></td>
                   <td width="68%" height="30px" bgcolor="#cccccc">
                        <input class="right" type="text" name="quantity" id="quantity" maxlength="4" size="4" style="ime-mode:disabled" onkeypress="return ValidateNumber(event)"
                            value=>
                     </td>     
                 </tr>
              </table>               
              <div align="center">
                    <input type="submit" value="新  增" name="submit" id="submit"  onclick="javascript: jsSubmit();">
                     <input type="hidden" name="query" id="query" value="">
                     <input type="hidden" name="txtMode" id="txtMode" value="">
                     <input type="hidden" name="txtDPY" id="txtDPY" value="">
                     <input class="right" type="hidden" name="txtNUM" id="txtNUM" value=0 >
                     <input type="hidden" name="DocRoot" id="DocRoot" value="https://www.my.tw">
              </div>
              <div align="left" name="dMSG" id="dMSG">       
                    訊息:             
              </div>
           </td>
        </tr>   
     </table>
  </form>         
   <div align="left" style="position: absolute; top: 120;left: 100px;width: 210px;height: 125px;" >
      <iframe name="list1" id="list1" frameborder="0" width="900" height="800" sandbox="allow-forms allow-scripts" src="RMA_request_list.php">
      </iframe>
   </div>
 
</body>
</html>
« 上次編輯: 2014-12-04 15:47 由 tonyvan123 »

tonyvan123

  • 活潑的大學生
  • ***
  • 文章數: 447
    • 檢視個人資料
Re: nav+iframe實例
« 回覆 #1 於: 2014-12-04 15:43 »
此程式的左方為nav+section+article
而右方的程式都是用iframe load進來

tonyvan123

  • 活潑的大學生
  • ***
  • 文章數: 447
    • 檢視個人資料
Re: nav+iframe實例
« 回覆 #2 於: 2014-12-04 15:44 »
<?php
   session_start();
   require_once($_SERVER['DOCUMENT_ROOT']."/inc/www.inc");
?>
<!DOCTYPE html> 
<html>
<head>
<title> MM代理商主頁 </title>
   <meta http-equiv="Content-Language" content="zh-tw">
   <meta http-equiv="content-type" content="text/html; charset=big5">
  <LINK rel=stylesheet type="text/css" href="/syn/fun/style.css">
  <LINK rel=stylesheet type="text/css" href="/syn/fun/MenuStraight.css">
   <meta http-equiv="refresh" content="1200;url=https://www.synvision.com.tw/MM/reload.php">
   <style type="text/css">
               
   </style>
   <SCRIPT Language="JavaScript"> 
     function LoadFunction(aID) {
       var iFUN=document.getElementById(aID.id);
       var iPRG=document.getElementById("iframe1");
       if (iFUN.id=="_Request") {
          iPRG.src="_request.php";
          iPRG.width="1000";
          iPRG.height="1800";
       } else if (iFUN.id=="_modify") {
           iPRG.src="_modify.php";
       } else if (iFUN.id=="_InProgress") {
          iPRG.src="_InProgress.php";
          iPRG.width="1000";
          iPRG.height="1800";
       } else if (iFUN.id=="_Query") {
           iPRG.src="_Query.php";
          iPRG.width="1000";
          iPRG.height="1800";
       } else if (iFUN.id=="_Shipping") {
           iPRG.src="_Shipping.php";
       } else {
          iPRG.src="ReLogin.php";
       };
     }
     
      
      function showtime24H(){
         var msg="";
         var now = new Date();
         var years = now.getYear()+1900;
         var months = now.getMonth()+1;
         var days = now.getDate();
         var hours = now.getHours();
         var minutes = now.getMinutes();
         var seconds = now.getSeconds();
         var timeValue = years ;       
         timeValue += ((months < 10) ? ":0" : ":") + months;
         timeValue += ((days < 10) ? ":0" : ":") + days;
         timeValue += "-";
         timeValue += ((hours < 10) ? ":0" : ":") + hours;   
         timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
         timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
         txtMSG=document.getElementById("txtMSG");
         txtMSG.value = msg+timeValue;

         var timeValue1= years ;       
         timeValue1 += ((months < 10) ? "0" : "") + months;
         timeValue1 += ((days < 10) ? "0" : "") + days;
         timeValue1 += ((hours < 10) ? "0" : "") + hours;   
         timeValue1 += ((minutes < 10) ? "0" : "") + minutes;
         timeValue1 += ((seconds < 10) ? "0" : "") + seconds;
         txtTIME=document.getElementById("txtTIME");
         txtTIME.value=timeValue1;
         
         timerID = setTimeout("showtime24H()",1000);
         timerRunning = true;     
      }     
      
   </script>
</head>
<body OnLoad="showtime24H();"> 
<header>             
   <table border=0 width="100%">
   <tr>
      <td align="center" widht="80%">MM代理商主頁</td>
      <td align="right">
         <input type=text name=txtMSG id=txtMSG size=16 disabled="disabled">
         <input type="hidden" name=txtTIME id=txtTIME size=16 disabled="disabled">
         <input type="hidden" name="txtCDEALNO" size=8 id="txtCDEALNO" value=<? echo($_SESSION["CDEALNO"]); ?> >
      </td>
   </tr>
   </table>
</header>   
<nav>
   <ul>   
            <li><a href="#" onClick="LoadFunction(this);" id="_Request">申請</a></li>
            <li><a href="#" onClick="LoadFunction(this);" id="_modify">申請修改</a></li>
            <li><a href="#" onClick="LoadFunction(this);" id="_InProgress">未結案的</a></li>
            <li><a href="#" onClick="LoadFunction(this);" id="_Query">維修件查詢</a></li>
            <li><a href="#" onClick="LoadFunction(this);" id="_Shipping">出貨查詢</a></li>
            <li><a href="#" onClick="LoadFunction(this);" id="ReLogin">重新登入</a></li>
   </ul>
</nav> 
<section>
   <article>
      <div align="left" style="position: absolute; top: 60px; left: 190px; width: 1110px; height: 600px;" >
        <iframe src="ReLogin.php" id="iframe1" width="100%" height="100%"></iframe>
      </div>
   </article>
</section>
<footer>
</footer>    
</body>
</html>