0

Use GetElementByID on two page html

I would create a new page taken some elements from another page, as I am a newbie I am look for on the web some help to use getelementbyId between this two page, but maybe this is the wrong way.

16th Feb 2020, 9:45 PM
Simone Cavalletti
Simone Cavalletti - avatar
15 Antworten
+ 3
getElementById() is used to embed some js onto a html elemement after firing an action on that element. Take for example a button, you can assign it an id attribute then specify what should happen when its either clicked or an action is executed in the document eg: <button id="btn">Click me</button> Now in js: function functionName() { alert("Hello"); } Let btn= document.getElementById("btn"); btn.addEventListener(click, functionName()); We just added a simple js code that alerts Hello when the button is clicked. The getElementById() was just used to help embed code to the particular button and not any other, because remember, id attribs are always unique. Happy coding 😉 Keep coding 💪
16th Feb 2020, 10:15 PM
Alfred Juma
Alfred Juma - avatar
+ 3
Use the DOM model in creating the second page since variables used in page one will be applied in page two
16th Feb 2020, 10:46 PM
Alfred Juma
Alfred Juma - avatar
+ 2
I imagined that this mod was not suitable. What can I use to build one page with elements of another?
16th Feb 2020, 10:38 PM
Simone Cavalletti
Simone Cavalletti - avatar
+ 2
None so far but code mode is not what you want because all the elements are launched in the same page....its just the elements getting handled using the pseudo classes in js
16th Feb 2020, 10:57 PM
Alfred Juma
Alfred Juma - avatar
+ 2
...but it moremor less carries the same concept
16th Feb 2020, 10:58 PM
Alfred Juma
Alfred Juma - avatar
+ 2
Ill work on that then
17th Feb 2020, 4:38 AM
Alfred Juma
Alfred Juma - avatar
+ 2
Gordon nodejs does not apply in fronend does it?
17th Feb 2020, 6:11 AM
Alfred Juma
Alfred Juma - avatar
+ 1
Be abit clearer
16th Feb 2020, 10:39 PM
Alfred Juma
Alfred Juma - avatar
+ 1
I have a dynamic page (page1) that do some calculations then I would like to create another summary page that retrieves some data from page1
16th Feb 2020, 10:41 PM
Simone Cavalletti
Simone Cavalletti - avatar
+ 1
Have you some example, so i can see better? Some like your code “Mood”?
16th Feb 2020, 10:47 PM
Simone Cavalletti
Simone Cavalletti - avatar
+ 1
Ok, I really need some example to understand better
16th Feb 2020, 11:02 PM
Simone Cavalletti
Simone Cavalletti - avatar
+ 1
Node.js works in backend, and that's how to "get element of first page for using in second page"
17th Feb 2020, 6:16 AM
Gordon
Gordon - avatar
+ 1
Ok got u
17th Feb 2020, 6:17 AM
Alfred Juma
Alfred Juma - avatar
0
Thanks Gordon!
17th Feb 2020, 6:23 AM
Simone Cavalletti
Simone Cavalletti - avatar