Data Transfer: Using Separate Page, Single Data

 Data Transfer: Single Data 

( Multi Data Link)

Using Separate Page on click Button in 3rd page With on click form open function-

Write the html code with script to input data 

In: -

<form>
  <input>

To: - 

<From >
   <Table>
      <Body>
         <td>



Code For:
In: -
<Button>

  <script>
    function openFormPage() {
      window.location.href = "form-page.html"; // Redirect to the form page
    }
  </script>

  <button onclick="openFormPage()">Go to Form Page</button>
( <script>
    function openFormPage() {
      window.location.href = "form-page.html"; // Redirect to the form page
    }

    window.onload = function() {
      document.getElementById("openFormButton").onclick = openFormPage;
    };
  </script>

  <button id="openFormButton">Go to Form Page</button>
 )

Code For:
In: -
<form>
  <input>

  

<script>
    function saveData() {
      // Get data from the table cell
      const tableData = document.getElementById("table-data").innerText;

      // Store the data in localStorage
      localStorage.setItem("tableData", tableData);

      // Redirect to the form page
      window.location.href = "form.html";
    }
  </script>

  <!-- Table with data -->
  <table border="1">
    <tbody>
      <tr>
        <td id="table-data">Example Data</td>
      

  <!-- Button to save data and navigate to form page -->
  <button onclick="saveData()">Go to Form</button>
</body>
</html>

Code For:
In: -
<table>
  <tbody>
     <tr>
       <td>

  <script>
    function loadData() {
      const retrievedData = localStorage.getItem("formData"); // Get data from localStorage
      if (retrievedData) {
        document.getElementById("dataCell").textContent = retrievedData; // Display data in table cell
      }
    }
    window.onload = loadData;
  </script>

  <table border="1">
    <tbody>
      <tr>
        <td id="dataCell">Data will appear here</td>
      

Comments

Popular posts from this blog

Text Designing "Formatting" HTML elements : html

Click Count Data Page: Spin/Vote