多个页面应从中央网页读取数据

时间:2019-01-22 07:43:42

标签: javascript html css

我正在尝试开发一个基于信息的网站,以展示由我的团队完成的自动化项目列表。想法是创建3个网页

第1页,将向客户交付有关自动化项目的信息(供客户查看) 第2页将具有指标,如自动化之前所花费的时间以及自动化之后所花费的时间等。这将显示在条形图和圆形图中(供管理人员查看) Page3,它应该像中心页面一样工作,在此输入的数据应反映在其他页面中。这将是表格格式

这里的问题是我正在努力编写代码,以使page1和page 2将自动从page3读取相应的数据。高度赞赏有关代码,链接或建议的任何帮助

enter code here

here is our code:



    html 1: dynamically added rows with  edit and save delete buttons  to a table 
           <body>
           <div class="marginT5 float_left"><img src="black.png" align="right" 
           width="260" height="100" 
            /></div>
          <div class="main_navline">
          <div >&nbsp;</div>

           <div  id ="test" title="" class="manu" align="center" > </div> 


           <div >&nbsp;</div>


           <form onsubmit="passing()" id="myForm" method="get" >
           <table  class="data_table" id="data_table" >


           <tr>
           <th>Level of the task</th>
           <th>Task</th>
    <th>Automation ID</th>
    <th>Activity</th>
    </tr>

    <tr>
    <td><input type="text" id="new_name"></td>
    <td><input type="text" id="new_type"></td>
    <td><input type="text" id="new_url"></td>
    <td><input type="text" id="new_description"></td>
    <td><input type="button" class="add" onclick="add_row();" value="Add Row"> 
          </td>
           </tr>




    </table>

    </form>

    html 2: the url and description of each row  entered in htm1 need to be displayed in html2

    <body >
    <div class="marginT5 float_left"><img src="black.png" align="right" width="260" height="100" 
  /></div>
    <div class="main_navline">&nbsp;</div>
    <div >&nbsp;</div>
    <div class="inner_wrapper">
    <div class="manu" align="center" >TEAM</div> 

    <div class="w3-container">

    <form name="form1" method="get">
    <table>
        <tr>
            <td id="here"></td>
        </tr>
    </table>
    </form>

    ourjavascript:


    function edit_row(no)

    {
          document.getElementById("save_button"+no).disabled = false;
         document.getElementById("edit_button"+no).disabled = true;

    /*  document.getElementById("edit_button"+no).style.display="none";

     document.getElementById("save_button"+no).style.display="block"; */

     var name=document.getElementById("name_row"+no);
     var url=document.getElementById("url_row"+no);
     var type=document.getElementById("type_row"+no);
      var description=document.getElementById("description_row"+no);

     var name_data=name.innerHTML;
     var url_data=url.innerHTML;
     var type_data=type.innerHTML;
         var description_data=description.innerHTML;
     name.innerHTML="<input type='text' id='name_text"+no+"' value='"+name_data+"'>";
     url.innerHTML="<input type='text' id='url_text"+no+"' value='"+url_data+"'>";
     type.innerHTML="<input type='text' id='type_text"+no+"' value='"+type_data+"'>";
      description.innerHTML="<input type='text' id='description_text"+no+"' value='"+description_data+"'>";
    }

    function save_row(no)
    {
     var name_val=document.getElementById("name_text"+no).value;
     var url_val=document.getElementById("url_text"+no).value;
     var type_val=document.getElementById("type_text"+no).value;
    var description_val=document.getElementById("description_text"+no).value;

     document.getElementById("name_row"+no).innerHTML=name_val;
     document.getElementById("url_row"+no).innerHTML=url_val;
     document.getElementById("type_row"+no).innerHTML=type_val;
    document.getElementById("description_row"+no).innerHTML=description_val;

     document.getElementById("save_button"+no).disabled = true;
         document.getElementById("edit_button"+no).disabled = false;


    /*  document.getElementById("edit_button"+no).style.display="block";
     document.getElementById("save_button"+no).style.display="none"; */
    }

    function delete_row(no)
    {
     document.getElementById("row"+no+"").outerHTML="";
    }

    function add_row()
    {
     var new_name=document.getElementById("new_name").value;
     var new_url=document.getElementById("new_url").value;
     var new_type=document.getElementById("new_type").value;
     var new_description=document.getElementById("new_description").value;

     var table=document.getElementById("data_table");
     var table_len=(table.rows.length)-1;
     var row = table.insertRow(table_len).outerHTML="<tr id='row"+table_len+"'><td id='name_row"+table_len+"'>"+new_name+"</td><td id='url_row"+table_len+"'>"+new_url+"</td><td id='type_row"+table_len+"'>"+new_type+"</td><td id='description_row"+table_len+"'>"+new_description+"</td><td><input type='button' id='edit_button"+table_len+"' value='Edit' class='edit' onclick='edit_row("+table_len+")'> <input type='button' id='save_button"+table_len+"' value='Save' class='save'   disabled onclick='save_row("+table_len+")'> <input type='button' value='Delete' class='delete' onclick='delete_row("+table_len+")'></td></tr>";

     document.getElementById("new_name").value="";
     document.getElementById("new_url").value="";
     document.getElementById("new_type").value="";
     document.getElementById("new_description").value="";



    }

0 个答案:

没有答案