www.webdeveloper.com
Results 1 to 5 of 5

Thread: General Javascript Question

  1. #1
    Join Date
    Mar 2014
    Posts
    2

    General Javascript Question

    Hi,

    I'm very new to Javascript and had a general question. I know that in javascript you have certain functions like getElementByTag or getElementByID to modify html pages and you can add links to an html page, align text and so on. My question is, what is the advantage of indirectly modifying an html page through javascript when you can modify the html directly without using any javascript?

    Thank you!

  2. #2
    Join Date
    Mar 2014
    Location
    New York
    Posts
    10
    Heeheheheh.....
    That's a good question i am not known about java but i used to do html of several sites and i use javascript in it...
    But you question blow my mind..

  3. #3
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,391
    If your page is static and does not normally change anything, then there is no advantage to using JS.

    If you want a page to animate, update, pre-submit validation, etc, then you would be hard pressed to do it without JS.

    Really depends upon your needs.
    Are there other programming languages that might accomplish your requirements, yes, but not many so easy to incorporate.

  4. #4
    Join Date
    Mar 2014
    Posts
    2
    Do you mean if you want the page to update on its own? Can you give me some more examples? Thank you.

  5. #5
    Join Date
    Mar 2005
    Location
    Behind you...
    Posts
    969
    Well, with things like 'getElementById()' and so on, it's not only about modifying the content, but also making your pages dynamic and more interactive. This goes from simply giving a user something nice to look at on a page to full video games right in the browser window. Anytime something on a page moves, interacts with a user (aside from a standard input) or changes, you will find javascript behind it (for the most part).

    In terms of content, it's possible to help present data on your page in a more controlled and user-friendly manor, such as hiding certain bits of a page until a user needs to see them (perhaps they are filling out a form, you can break it in to sections or steps then hide and display each step as the user needs, all on one page). Also through the use of AJAX you can actually load entirely new page content without having to leave the page, which is good for standard content as well as dynamic content (requesting reporting data, simple chat/messaging, sending/receiving file data (somewhat limited on the upload)).

    And let's not forget about analytics data. With javascript you can keep track of how users interact with your page and how long they stay on a page. There are tons of metrics to gather about users on your website and javascript makes it easier to get that data (and save it on some server somewhere).

    Javascript is capable of some very amazing things, and the list continues to grow as browsers and computers become more powerful and complex.
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles