JavaScript display new page when submit HTML form

前端 未结 4 1795
庸人自扰
庸人自扰 2021-01-07 14:02

Suppose I have 2 html files: form.html and confirm.html

form.html just have a text field and a submit button, when you hit submit it will display what you just typed

4条回答
  •  萌比男神i
    2021-01-07 14:36

    You can try using localStorage or cookies. Check one of the 2 solutions found below...

    1 - If you have HTML5, you can store the content of you input into the localStorage.

    Try this example:

    form.html:

    
    
        Test
         
    
    
        


    confirm.html:

    
    
    
        
    
    
    
    
    
    
    

    2 - Also, as @apprentice mentioned, you can also use cookies with HTML standards.

    Try this example:

    form.html:

    
    
        Test
         
    
    
        


    confirm.html:

    
    
    
        
    
    
    
    
    
    
    

提交回复
热议问题