![]() |
|
[Javascript] [help] paragraph random positioning - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183) +---- Thread: [Javascript] [help] paragraph random positioning (/showthread.php?tid=4301557) |
[help] paragraph random positioning - Melkor333 - Jun 23, 2014 okay, i recently started with javascript, and I'm messing a little around to learn how i can use it for webdev. Now i wanted to make a script which adds a text somewhere on the page whenever the user presses enter. Spoiler (Click to View) The problem is, the distance to the top becomes more, thus the page becomes longer. And sometimes the text doesn't appear on the screen (I'm pretty sure it's inserted outside of the window..) The code is this atm: PHP Code Oh and if you see some outdated or stupid methods, please tell me!!! Thhx alot in advance! 🤝 * - JumpWar - Jun 23, 2014 Look at what I made Code <html >What helped: actually positioning the p tags absolute by using a <style> tag. Also setting display to inline-block because that was what made the display bigger. I also created an object to use and inserted that into the DOM using appendChild this also allows to just refer to it later instead of setting and getting it using and ID. Hope this helps you out JumpWar * - Melkor333 - Jun 23, 2014 thhx alot man! This is what I was searchin for! 🤝 🙂 |