2014-09-19 37 views
0

美好的一天,我在這裏的問題是,雖然我在MainScreen.html,即「環境管理計劃」 DIV我不能改變EmployeeInformation.html的div的內容,其中有「DDDDDDDDDDDDDDDDDDDDDD」通過加載的內容Personal.html,使用jQuery。爲什麼我不能更改div的內容?

步驟是: 在MainScreen.html中,單擊「?EmployeInformation」,然後單擊「?QQQQ」鏈接。

MainScreen.html

<!DOCTYPE html> 
<html> 
    <head> 
     <link href="./MainScreen.css" rel="stylesheet" type="text/css"> 
     <script src="./Jquery/dev/jquery-2.1.1.js"></script> 
     <script src="./MainScreen.js"></script> 
    </head> 
    <body> 
     <div id="AccountHeader"> 
      CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 
      <br> 
      CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 
     </div> 
     <div id = "HeaderImage"> 
      <img src="./Images/header.jpg"> 
     </div> 
     <div id="MenuList"> 
      <ul id="NavigationBar"> 
       <li><button>Notifications</button></li> 
       <li><button>File Maintenance</button></li> 
       <li><button>Transaction</button></li> 
       <li><button>Reports</button></li> 
      </ul> 
     </div> 
     <div id="LeftPanel"> 
      <ul id="FileMaintenanceMenu"> 
       <li><a href="#">?Authorized Overtime Schedule</a></li> 
       <li><a href="#">?Bank</a></li> 
       <li><a href="#">?Calendar of Length of Service</a></li> 
       <li><a href="#">?Degree</a></li> 
       <li><a id = "link" href="#">?EmployeeInformation</a></li> 
       <li><a href="#">?Employees with Evening Service</a></li> 
       <li><a href="#">?Employees with Extra Load</a></li> 
       <li><a href="#">?Function</a></li> 
       <li><a href="#">?Honorarium of Coaches</a></li> 
       <li><a href="#">?Mode of Salary</a></li> 
       <li><a href="#">?Non-Working and Special Holiday</a></li> 
       <li><a href="#">?Parameter File</a></li> 
       <li><a href="#">?Part-time Employees</a></li> 
       <li><a href="#">?Plantilla</a></li> 
       <li><a href="#">?Position</a></li> 
       <li><a href="#">?Public Holiday</a></li> 
       <li><a href="#">?Salary Schedule</a></li> 
       <li><a href="#">?Special Projects</a></li> 
       <li><a href="#">?Status of Employment</a></li> 
       <li><a href="#">?Student Assistant</a></li> 
       <li><a href="#">?Titles/ Designation</a></li> 
       <li><a href="#">?User/ Password Maintenance</a></li> 
       <li><a href="#">?Withholding Tax Table</a></li> 
      </ul> 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
      <br>AAAAAAAAAAAAAAAAA 
     </div> 
     <div id="RightPanel"> 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
      <br>BBBBBBBBBBBBBBBBBBBBBBBBB 
     </div> 
    </body> 
</html> 

MainScreen.js

$(document).ready(function() {  

    $("#link").click(function() 
    { 
     alert('a'); 
      $("#RightPanel").load("./FileMaintenance/EmployeeInformation.html"); 
    }); 
}); 

EmployeeInformation.html

<!DOCTYPE html> 
<html> 
    <head> 

     <script src="../Jquery/dev/jquery-2.1.1.js"></script> 
     <script src="./EmployeeInformation.js"></script> 
    </head> 
    <body> 
     <form id = "BasicInfo" method="post" action="EmployeeInformation.html"> 
      <span class = "FieldLabels">ID Number</span> <input type="text" id="IdNumber"> 
      <br> 
      <input type="text" id="LastName">&nbsp;&nbsp;&nbsp; 
      <input type="text" id="FirstName">&nbsp;&nbsp;&nbsp; 
      <input type="text" id="MiddleName"> 
      <br> 
      <span class = "FieldLabels">Last Name</span> 
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      <span class = "FieldLabels">First Name</span> 
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      <span class = "FieldLabels">Middle Name</span> 

     </form> 
     <ul id = "EmployeeInfoTabs"> 
      <li><a id = "the" href="#" onclick="alert('b')">?QQQQ</a></li> 
      <li><button>?Personal</button></li> 
      <li><button>?Employment</button></li> 
      <li><button>?Payroll Info</button></li> 
      <li><button>?Family and Other Info</button></li> 
      <li><button>?Previous Employment</button></li> 
     </ul> 
     <div id= "Emps">DDDDDDDDDDDDDDDDDDDDDDDDDDD</div> 
    </body> 
</html> 

個MainScreen.js

$(document).ready(function() { 

    $("#the").click(function() 
    { 
     alert('c'); 
      $("#Emps").load("./EmployeeInformation/Personal.html"); 
    }); 
}); 

Personal.html

<!DOCTYPE html> 
<html> 
    <head> 
     <script src="../../Jquery/dev/jquery-2.1.1.js"></script> 
    </head> 
    <body> 
     <div id= "aaaaa">AAAAAAAAAAAAAAAAAAAAAAAAAAA</div> 
    </body> 
</html> 

什麼是我的錯?

我也嘗試去「EmployeeInformation.html」手動,它的工作原理,它將「DDDDDDDDDDDDDDDD」更改爲「AAAAAAAAAAAAAA」,但是,如果我在MainScreen.html它不起作用,爲什麼?

的步驟是MainScreen.html,點擊 「?EmployeInformation」,然後單擊 「?QQQQ」 鏈接。

順便說一句,我想直接在這裏上傳PIC,但我的名譽點小於10 :(

所以,這裏是鏈接到圖片:

文件的目錄和文件夾: https://onedrive.live.com/redir?resid=20796C7633AE90D!233&authkey=!ACNqvIRZeJYPMkE&v=3&ithint=photo%2cJPG

MainScreen.html https://onedrive.live.com/redir?resid=20796C7633AE90D!235&authkey=!AJrxTsF0sugU-eE&v=3&ithint=photo%2cJPG

感謝您的幫助:d

+1

顯示一些代碼笏試試嗎? – Panther 2014-09-19 15:52:17

+0

我很抱歉後期上傳,我以爲我已經包括它:) – nightrobin 2014-09-19 18:13:57

回答

0

無需任何代碼,看看,我將從一個基本的答案開始。

假設你有機會獲得DIV,這裏是如何改變其使用jQuery,內容你似乎可以用:

這是一個獨特的ID的DIV:

<div id="mydiv">DDDDDDDDDDDDD</div> 

這是代碼來改變它:

$("#mydiv").html("EEEEEEEEEEEEE"); 

您還可以使用html()來獲取元素的內容。

相關問題