2

i want to transfer the input value from these textbox to another web page textbox in html there are two files this is the first web page javscript code function to transfer file to another web page

        function transferdata() {
        
        var inputTest = document.getElementById('FROM').value;
        var inputTest1 = document.getElementById('TO').value;
        var inputTest2 = document.getElementById('jdate').value;
        if (inputTest=="") {
                            window.open('report_pengambilan_singgle.html','','height=650,width=1200');
                    }   
                    else {
        
                            window.open('trial25.html?name=' + inputTest,'','height=650,width=1200');
                       
                    }
        
        }
html code
        this is the body of the code
         <form >
            <label ><H2>SOURCE</h2></label><br>
            <input type="text" id="FROM" name="FROM" ><BR>
            <label ><H2>DESTINATION</H2></label><BR>
            <input type="text" id="TO" name="TO" ><BR>
             <h2> Date of Journey<input type = "date" name = "jdate" id = "jdate"></h2>
             <br>
            
          </form>
        
        second file this the another file which will recive the data
javscript code
         // Recive data from destination.html
           window.onload = function () {
        var url = document.location.href,
            params = url.split('?')[1].split('&'),
            data = {}, tmp;
        for (var i = 0, l = params.length; i < l; i++) {
             tmp = params[i].split('=');
             data[tmp[0]] = tmp[1];
        }
        
        document.getElementById("source1").value = data.name;
        document.getElementById("date").value = data.name;
        document.getElementById("dest").value = data.name;
        
        }
html code
    this is the body of the another web page code 
        <form>
        <h3> Source <input type = "text" name = "source1" id = "source1" /> </h3>
         <h3> Destination <input type = "text" name = "dest" id = "dest" /> </h3>
        <h3> Booking Date <input type = "date" name = "date1" id = "date1" /> </h3> 
         </form>

this the input field in which i want to recive data from first web page input field

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.