Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
Autumn, 18 Sep 2026 - @443.63
Forum Activity: Four Stars Random | Recent Posts | Guild Recents
News: :defrag: Lo and Behold :defrag: Guild Events: weekly zine theme 12: television

+  MelonLand Forum
|-+  Da Web Revival
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  Help with Swatch Clock


« previous next »
Pages: [1] Print Embed
Author Topic: Help with Swatch Clock  (Read 1029 times)
Ajsiets
Newbie ⚓︎
*
View Profile WWW


⛺︎ My Room

Artifacts:
Joined 2024!
« on: Summer, 04 Aug 2024 @194 beats » Embed

Hi! I've wanted to experiment with integrating JavaScript with a website, and I thought a simple project would be adding a swatch clock, but for some reason it doesn't seem to work? I copied the code from Melon's post about swatch clocks, and followed the instructions as best as I know how to, but it just displays "@000" which I have in there as static default text that's supposed to be replaced by the clock itself. I've attached some screenshots of the code if anyone can help me find what I might be missing? I've included the JavaScript file, as well as the span that holds the clock, and the script tag where I've linked the .js file. Thank you very much!

https://github.com/ajsiets/ajsiets.github.io/blob/main/Code.PNG?raw=true
https://github.com/ajsiets/ajsiets.github.io/blob/main/Script.PNG?raw=true
https://github.com/ajsiets/ajsiets.github.io/blob/main/Span.PNG?raw=true

Logged
Memory
Guest

« Reply #1 on: Summer, 04 Aug 2024 @414 beats » Embed

[removed by author]

« Last Edit: Summer, 07 Aug 2024 @476 beats by Memory » Logged
rhenn
Jr. Member ⚓︎
**
View Profile WWW


⛺︎ My Room
StatusCafe: rhenn

Artifacts:
Joined 2024!
« Reply #2 on: Summer, 04 Aug 2024 @533 beats » Embed

J makes some good points!

I'd also recommend using the defer keyword when running scripts on your site, it makes sure that the script doesn't run until all of your html is loaded. If you have your script in the <head> of your html, functions like document.getElementById can break because the elements they're looking for haven't loaded yet.

Code
<script defer src="/script.js">

Logged

https://f2.toyhou.se/file/f2-toyhou-se/images/77020746_kuzVGSABhs21uUT.png
Pages: [1] Print Embed 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | Send Feedback | Supporters ♥ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi
@000 Melon
Land
Editor Recent Edits Tenement Arcade Random Link Land → Forum Art Hub Chat Webring Want to Login or Join ? Web Craft Guide Graphic Catalogue Wiki Newsletters Image Stream
Passport Sites Asatte Add your site?
Zap!
Minecraft: Online
Join: craft.melonking.net