简体   繁体   中英

how to getElementbyid for Another HTML Page

Can someone please explain how/why this behavior..

I am writing an app using eel. eel starts with page1.html. also there is another page called page2.html. but it is not loaded till I press on some link.

My Problem is, I need to insert some values in page2.html before I click on the link and open it. but in Javascript , each time I apply Getelementbyid . i receive null response. I have added eel.js in all html pages also all other Javascripts in all.html pages are in the same init folder.

You can send data to page2 with GET param:

//use this link param is name of param and values is the value of param
page2.htmnl?param=value;param2=value

In page2, in onload event you get values:

var url_string = window.location.href;
var url = new URL(url_string);
var param = url.searchParams.get("param");
var param2 = url.searchParams.get("param2");
console.log(param, param2);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM