I have prompt, and I want it so that when a person enters in something, for example - I ask: What is you namn? And the person responds John. Then I want it to appear on my other html page that says Hello John, with innerhtml. So it's not a popup but actually on the other page
But I can't seem to take the input the user writes in to my new page
您可以使用cookie来做到这一点。
Link to the page with a parameter in the URL
eg. www.mywebsite.com?name=John
Then access the param on the new page with window.location.query
我倾向于将输入传递给隐藏的表单域,然后将表单提交给第二页。
Why not use JavaScript localStorage API?
Your current page:
var x = prompt('your name?');
if ( x ) {
localStorage.setItem('person_name', x);
// do redirection
}
On next page you can get your value with following:
var whatImage = localStorage.getItem('person_name');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.