ok so im starting out in html and know the pure basics of javascript... (know a little bit of c++ but that wont help me here i think)
well anyway i need to make a website and from what im understanding is that javascript basically does animations (i think)
on the sites and things like if you click here, this will happen etc..
so is there a way someone can help me out here?
like tutorials or just tips etc... thanks.

Dani AI

Generated

A short, practical primer for that ties together the replies here:

JavaScript is the language that adds behavior to HTML/CSS pages — not just animations. It handles events (clicks, form submit), DOM updates, fetching data (AJAX/fetch), games and app logic. For simple visual effects use CSS transitions/animations (hardware-accelerated when you animate transform or opacity). For game-like or frame‑by‑frame motion use requestAnimationFrame. Note: Flash is obsolete and should be avoided; animated GIFs are only good for simple loops.

Keep structure simple and modern: index.html, styles.css, app.js. Prefer an external script loaded with defer or placed just before </body> rather than inline handlers. As suggested, use event listeners — avoid onclick attributes; attach behavior unobtrusively. As noted there are several placement options, but external+defer is usually best.

Useful starter pattern (run after DOM ready, toggle a class to trigger CSS transitions):

document.addEventListener('DOMContentLoaded', function () {
  var btn = document.querySelector('#myButton');
  var box = document.querySelector('#myBox');
  btn.addEventListener('click', function () {
    box.classList.toggle('active'); // trigger CSS transition/animation
  });
});

Performance & safety tips: prefer CSS transforms over animating top/left; use requestAnimationFrame for JS loops; avoid eval() and inserting unsanitized HTML (use textContent or proper sanitization). When things fail, open DevTools console, verify script paths, check for selector typos, and set breakpoints.

Further reading: MDN JavaScript Guide, Using CSS animations and the addEventListener documentation. As demonstrates, once comfortable with these basics you can build interactive games and experiments.

Recommended Answers

All 3 Replies

Well you wanna use HTML and Java-Script in your web page.
I think you now decided the best for your page,because Java-Script increases the flexibility of the HTML pages.You can use Java-Script in three ways for your HTML page i.e.1>Inside the head tag,if you want to run java when it is called.
2>Inside the body tag,if you want to run java on loading your page.
3>The most used way i.e. you can write Java-Script externally and link it to your HTML page.
By following the above you can now make your page dynamic and user friendly too!!

You can search javascript event handlers if you like. Javascript has methods like onclick(), onsubmit(), onmouseover() and more to handle those kinds of things.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.