(Pretty beginner) html help

Chao Tse-Tung

Chairman of the Deep-State Cabal, KEC
Gold
Joined
Jan 1, 2022
Messages
267
Reaction score
1,027
Awards
109
Website
aoaed-official.neocities.org
So I'm gonna start working on my neocities again soon, and I want something that is (functionally) the same as the random agora quotes you get here.

Now, I'm not completely clueless, I can roughly imagine that there's some page containing a list of strings and then you somehow pull randomly from that list to put them on your visible page every time the page loads. Am I way off base? Regardless, guidance would be mighty helpful.
 
Virtual Cafe Awards

shinobu

Jack of all trades
Joined
Dec 17, 2021
Messages
365
Reaction score
2,676
Awards
187
95% sure it's some Javascript. edit: actually, it could be PHP, but you can't do it like that in neocities so what I wrote still is the way to do it in neocities

First you create a <div> or some other element in HTML, you give it an id like randomquote, and then in a <script> tag you define a list of quotes, select one at random and put it in the div's innerHTML
let quotes = ["quote a", "quote b", "quote c"]; let selectedQuote = quotes[Math.floor(Math.random()*1000) % quotes.length]; document.getElementById('randomquote').innerHTML = selectedQuote;
Something like this
 
Last edited:
Virtual Cafe Awards

Similar threads