(best) uses of javascript in a simple website?

Discussion in 'Web Design and Development' started by jonpeter, Oct 24, 2013.

  1. jonpeter macrumors member

    Joined:
    Sep 19, 2013
    Location:
    MI
    #1
    aside from the typical weather/music playing widget, what uses does javascript provide?

    also, if i wanted to have a user input their information, how would i save that information that i could use later?
     
  2. 960design macrumors 68020

    Joined:
    Apr 17, 2012
    Location:
    Destin, FL
    #2
    Let's see how many pundits I can bring out of the woodwork!

    The Basics 101:
    HTML = structure
    This to actually build your website 'skeleton'.

    CSS = styling
    This is tied to HTML structure elements to change their default look and with CSS2/3 some of their default actions

    JavaScript = action
    This is used to move things on the page with and without user interaction.

    For example a button is created with HTML. Made to have a gradient, blue background with white lettering and rounded borders with CSS. CSS also changes to look of the button when hovered over or clicked. Javascript would change the default behavior of that change. It could make the switch a soft change that happens over half a second.

    Kinda advanced stuff:
    I also use JavaScript to pull credit card information and send it directly to the merchant gateway. The credit card fields don't have a name so they never get included in the $_POST array and are NEVER sent to my servers. Only the merchant gateway sees the information and passes back a 'token' that I use to verify success or failure of the charges.

    PHP = persistance and dynamism
    This is used to store information in a text file or more often in a database. This can also be used to gather data, for example the weather from different locations.

    JavaScript + PHP = AJAX in page dynamics ( no page reloading, updates happening right on the page, while you are looking at it ). I use it extensively for data entry. As the user exits a field the information is immediately stored in the database. No need to click a submit button.

    To answer your second question:
    An HTML form would be used to gather data. The information could be passed to an email, database, text file using PHP and a submit button or javascript and PHP for the AJAX stuff.
     

Share This Page