2016-05-31 69 views
0

從下面的代碼我必須創建一個強制性的門戶網頁,其中有兩個按鈕,其中一個將有一個用戶輸入他/她的名字,密碼並繼續,另一個將只是一個繼續按鈕,它將自動引導用戶到重定向網站,而無需用戶輸入任何內容(他們只需點擊繼續 - 「用戶名」和「密碼」已經定義)。問題是,我需要在同一頁面上,它不工作,在不同的頁面上,它完美的作品。Captive Portal上的HTML問題

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"> 
 
<head> 
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
 
<title>Company Name Hotspot - Secure Access!</title> 
 
<style type="text/css"> 
 
body { 
 
background-color: #000; 
 
} 
 
.offer { 
 
font-size: 24px; 
 
color: #F00; 
 
text-align: center; 
 
} 
 
.bolder { 
 
border: 1px solid #FFF; 
 
} 
 
.copyright { 
 
font-size: 12px; 
 
text-align: center; 
 
color: #FFF; 
 
} 
 
.button { 
 
font-size: 16px; 
 
font-weight: bold; 
 
} 
 
body,td,th { 
 
color: #6FF; 
 
font-family: Arial, Helvetica, sans-serif; 
 
font-size: 16px; 
 
} 
 
</style> 
 
</head> 
 

 
<title>Secure Access - Login</title> 
 
<body> 
 
    <form method="post" action="$PORTAL_ACTION$"> 
 
    <input name="redirurl" type="hidden" value="$PORTAL_REDIRURL$"> 
 
    <input name="zone" type="hidden" value="$PORTAL_ZONE$"> 
 
    <center> 
 
    <table cellpadding="6" cellspacing="0" width="780" height="380" style="border:1px solid #000000"> 
 
    <tr height="10" bgcolor="#990000"> 
 
     <td align="center" style="border-bottom:1px solid #000000"> 
 
     <font color='white'> 
 
     <b> 
 
     Welcome to Bharat Telecom Hotspot 
 
     </b></font></td> 
 
    </tr> 
 
    <tr> 
 
     <td> 
 
     <div id="mainlevel"> 
 
     <center> 
 
     <table width="100%" border="0" cellpadding="5" cellspacing="0"> 
 
      <tr> 
 
      <td> 
 
      <center> 
 
      <div id="mainarea"> 
 
       <center> 
 
       <table width="100%" border="0" cellpadding="5" cellspacing="5"> 
 
       <tr> 
 
       <td> 
 
        <div id="maindivarea"> 
 
        <center> 
 
        <div id='statusbox'> 
 
        <font color='red' face='arial' size='+2'> 
 
         <b> 
 
         
 
         </b> 
 
        </font> 
 
        To gain access through the internet, Please enter your Username and Password or Voucher Code.<br><br> 
 
        If you have any difficulties you may contact our technical support technician at (Tel. No Here)<br><br> 
 
\t \t \t \t \t Kindly Note that you will be exited after 5 minutes by using the Free Wifi Access.<br><br> 
 
\t \t \t \t \t Click the Button to continue as free User.<br></div> 
 
        <br/> 
 
<div id='loginbox2'> 
 
<table> 
 
    \t \t \t \t \t <tr><td><input name="auth_user" type="hidden" type="text" value="User"></td></tr> 
 
    \t \t \t \t \t <br> 
 
    \t \t \t \t \t <tr><td><input name="auth_pass" type="hidden" type="password" value="abc"></td></tr> 
 
    \t \t \t \t \t <br> 
 
    \t \t \t  \t <td><input class="button" name="accept" type="submit" value="Continue"></td> 
 
</table> 
 
</div> 
 
        <div id='loginbox'> 
 
    \t \t \t \t \t 
 
        <table> 
 

 

 

 
         <tr> 
 
          <td align="right">&nbsp;</td> 
 
          <td>Free User</td> 
 
          </tr> 
 
         <tr><td align="right">Username:</td><td><input name="auth_user" type="text" ></td></tr> 
 
         <tr><td align="right">Password:</td><td><input name="auth_pass" type="password" ></td></tr> 
 
         <tr> 
 
          <td colspan="2" align="right">&nbsp;</td> 
 
          </tr> 
 
         <tr> 
 
          <td align="right">&nbsp;</td> 
 
          <td>Voucher</td></tr> 
 
          <tr> 
 
          <td align="right">Voucher Code:</td> 
 
          <td><input name="auth_voucher" type="text"></td> 
 
          </tr> 
 
          <tr> 
 
          <td align="right">&nbsp;</td> 
 
          <td><input name="accept" type="submit" class="button" value="Continue"></td> 
 
          </tr> 
 
          <tr> 
 
          <td align="right"></td><td></td></tr> 
 

 

 
        </table><br /> 
 
                        <hr /> 
 
        
 
         <p>&nbsp;</p> 
 
                       </div> 
 
        </center> 
 
        </div> 
 
       </td> 
 
       </tr> 
 
       </table> 
 
       </center> 
 
      </div> 
 
      </center> 
 
      </td> 
 
      </tr> 
 
     </table> 
 
     </center> 
 
     </div> 
 
     </td> 
 
    </tr> 
 
        <tr height="10" bgcolor="#990000"> 
 
     <td align="center" style="border-bottom:1px solid #000000"> 
 
     <p><font color='white'> 
 
      <b> 
 
      ©Copyright 2016 Company Hotspot. All Rights Reserved. 
 
</b></font><br /> 
 

 
    </tr> 
 
    </table> 
 
    </center> 
 
</form> 
 
</body> 
 
</html>

回答

1

首先,你怎麼知道哪個按鈕是做動作(提交)? 在您的代碼中,無法區分哪個按鈕,因爲它們都具有相同的名稱和值。

您可以使用相同的名稱但不同的值並相應地處理代碼。例如,對於你的第二個按鈕,你可以使用一些其它的值,如「繼續無密碼」

<input name="accept" type="submit" class="button" value="Continue Without Password"> 

或者,你可以使用兩個按鈕與所有不同的名稱,如「接受」和「accept_1」有兩個按鈕對象在一個單一的HTML。

+0

但在第二個按鈕中沒有任何價值。 – BeachSamurai

+0

我改變了數值,也改變了按鈕的名字,但沒有改變,它仍然是一樣的。我想知道如何解決它。 – BeachSamurai

+0

是的,我做了它,我改變了按鈕名稱,並且還將表格分成了兩半,一半用於一個按鈕,另一半用於另一半。真的非常感謝一堆。 – BeachSamurai