Home > Web Front-end > JS Tutorial > body text

JavaScript event mechanism

高洛峰
Release: 2016-11-25 11:40:32
Original
1195 people have browsed it

Parent form html document:



Student Management
                                                                                                                                                 // Call Modal form, enter student information in the modal form and then pass it to the parent form.
            var result = window.showModalDialog("addinfo.html", , "dialogwidth:800px;dialogheight:300px");//result receives an array object

                    //alert(result: + result[0]); // Output the return value, result returns not a string, but an array
                                                                         /////////The following is used to judge that when all the boxes in the add page of the mode are empty, there is no need to add a row in the main form.
          var flag = 0; (result[i].match(/^s*$/)) {
                                                                                                                                                                                                                                     ​;
                                                                                                           ! = undefined) {//
                                                                                                                                                                                         "myTable" ) );/ /Pass two parameters to the addRow method, one is the returned result and the other is the table to be operated on
                                                                                                                                                                                                  /
                / /alert ( myTable );
                                                                                                                                                                                          . i++ ){//According to the result Create the corresponding number td 数

创 = Document.createElement (TD);














// add
tr.appndchild (TD); // Add to the back of tr
                                                                                                                                                                                  .myTable.appendChild(tbody); //Add the created tbody to the table to be displayed,
              // The above is actually the process of creating html through the document object
                                                                   ----------//Create an event trigger for each tr row created
                                                                                                                                   but   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Proxy that when the mouse is moved,
tr.style.backgroundcolor = "#abcdef"; // Background color. Tr.tition = "Click to modify!"; // Reminder information};

tr. = Function () {////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////gang ////////////////////////////After the mouse is released
                                                           //Register Click event
            tr.onclick = function(){//////////////////////////////////////// ////////////////////When the mouse clicks
                                                                                                                                      Display the current row data in the cell collection cells
                                                                                                                                                                                                                                      . /Create a temporary array to store to be passed to the modal dialog box The data of nerHTML;//Put the content in the cell of the selected row Temporary array
                                                                                                                                                          td in tr​​​                                                                                   
                                                                                                           
     


     

     

           
                     
                   
                  
                   
                      
                  
                   
                  
                      
                      
                      
                      
                      
                        
                        
                   
           
学生信息管理

                           
                      
姓名年龄性别学校是否删除

      
     

     



 
添加子窗体html文档:


    添加学生信息
    
            
        
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!