Jump to content

practical uses of javascript


darbok

Recommended Posts

So i'm studying javascript, learning the different parts etc... but none of the training shows how to use it in a practical way in a webpage, thus far its all been academic, is there anywhere that I see practical ways to use it? or get examples.

  • Like 1
Link to comment
Share on other sites

One of the basic applications of Javascript is to use it to validate a form before allowing the form to be submitted to the server. This provides the user with a faster response and reduces the server workload.

Link to comment
Share on other sites

A majority of websites today use Javascript. This editor you're using to write your posts uses Javascript. Click the "B" button and the text becomes bold, that's done with Javascript.

 

Any part of the page that changes after the page has loaded is done with Javascript.

Link to comment
Share on other sites

Things like Gmail, Google Maps, Facebook, etc all use Javascript. Any time you're interacting with a web site without the entire thing refreshing (e.g. opening an email, dragging or zooming a map, liking a post or making a comment), it's Javascript that makes that possible. Without Javascript, any time the page would change would require the entire thing to be refreshed from the server.

Link to comment
Share on other sites

  • 2 months later...

So i'm studying javascript, learning the different parts etc... but none of the training shows how to use it in a practical way in a webpage, thus far its all been academic, is there anywhere that I see practical ways to use it? or get examples.

I see it the same way, I do understand that it can do a lot more, but the basics of what is in the examples seems to be difficult to find a use for at the learning stage. The Examples have the () and the (demo) and that kind of thing. The problem for me is I don't know what parts are completely defined by my own shorthand words; like is the "demo" thing in the parentheses an actual command? or how about the other various ones that have words and than mid way in word it has capital letters. that seems more like a rule,

 

Everytime I try some action like putting a button function to a secondary button function I cannot seem to get any action at all., I guess it would help to know the variables, I mean by that things that are completely individual and up to me to write?

 

Is the myFunction or "getElementById" a set phrase of letters or is only part of it?

Link to comment
Share on other sites

The document object is defined by the browser, so that defines things like document.getElementById.Here's the MDN reference for the document object:https://developer.mozilla.org/en-US/docs/Web/API/documentThat provides a list of everything that is defined on the document object. You can go through that MDN list to see other objects and types to see what is defined on them by default. When you use getElementById, for example, it will return an HTMLElement object. The reference for that is here:https://developer.mozilla.org/en-US/docs/Web/API/HTMLElementThe note on the top indicates that the HTMLElement object inherits all of the properties and methods from the more generic Element object, so all of these are defined also:https://developer.mozilla.org/en-US/docs/Web/API/ElementThe note on the top of that page says that the Element object inherits other properties from the more generic Node object (in addition to some others like ParentNode and ChildNode), so all of these are defined also:https://developer.mozilla.org/en-US/docs/Web/API/Node

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...