I don´t understand what good it does in webdesign, to use the computer as a calculator?
I can see that it can be useful to be able to write a code that can show the time and date when a button on the webpage is ckicked on, but a lot of the examples in the tutorial are just about writing code with different math questions, and then the browser writes a number....what shall I use that for in webdesign? I could just as well just write 11 i normal HTML, and the screen would display 11, instead of writing a code in JavaScript, that makes the screen display 11...
Copyright © 2024 1QUIZZ.COM - All rights reserved.
Answers & Comments
Lots of pages these days use JavaScript to make the content of the page more responsive for the user without have to constantly get a new page from the server. For example in Yahoo Answers when you add an answer, it just appears at the bottom of the list without the whole page having to be refreshed, this is done with JavaScript. This not only makes the page more responsive, but also takes some load of the server. There is also a trend now toward what are called Single Page Apps, which are web applications that almost never post back to the server. Once the page is loaded everything happens in JavaScript on the client and just request for data are sent back and forth to the server.
You will use JS in any web page that needs to change content as an immediate response to user input. The web server doesn't see any of those events, so even a smart server that uses scripting to customize a web page can't do that for you.
The arithmetic and computation you are learning can be useful. Suppose you are designing a shopping page. You can have the JS keep track of selected items on the page and display a running total. There's where you'd use arithmetic. Maybe some interesting arithmetic if you are keeping a running estimate of tax and shipping.
Clicking on "Blue" as a color choice for a shirt could switch the <img> target to the image of a blue shirt.
Both of those also require knowing how to use the Document Object Model (DOM) to inspect and maybe change, delete or insert elements. (Don't let the formal sound of DOM spook you. You get a predefined object named "document" and that has a bunch of predefined methods to do useful things with the displayed page.)
You don't need javascript in any normal web page.
The commonest (and bad) use by new web designers is to stick loads of animations and gimmicks in pages. Doing that just makes for bloated and unresponsive sites..
Learn PHP and MySQL first, so you can make interactive / data driven sites.
After that, you can start to use fragments of javascript to do such as AJAX interaction with the server - that allows pages to just update a small area by requesting and inserting new data, rather than having to re-load the entire page to update a part as with simple HTML.
https://developer.mozilla.org/en-US/docs/AJAX/Gett...