Home » questions » what difference dose it make main HTML and java script?

what difference dose it make main HTML and java script?

2006-08-01 14:00:11, Category: Programming & Design

Answers

  1. tedjn

    On 2006-08-01 14:46:53


    There is a distinction to be made: whether you are talking about Java script or, as I suspect, Javascript. The former can be used in relation to the web in two ways: as applets or as JSP if you use it as your server-side language. As an applet, it is compiled bytecode and completely different from HTML altogether and not really related. If it is JSP, it is, as Steve said, code that can be used to output HTML. But as a scripting language, it can be used to make decisions. For instance, suppose you want a page to display a login screen for users who have not logined and their main page otherwise! You can use JSP to decide what to HTML to output! However, if you are talking about Javascript, it is a different matter altogether. Javascript is a client-side scripting language. This means that you do see Javascript code. In fact, the server doesn't even parse it. It is up to your browser to do the effects that Javascript code for. This is most readily understood by disabling Javascript in your browser. This means Javascript won't be executed because you told your browser to not run the script(s). As for the difference, Javascript is a scripting language while HTML is a markup language. HTML describes your data, how it should look, and in what order it goes in. Javascript makes decisions. Perhaps it wants to display a special message at 3:00 am on the user's clock. Well, you need Javascript to make that decision. In fact, with DHTML and the ability to make changes to the DOM, you can use Javascript to change how pages look depending on certain conditions. You can use it to modify the HTML in your pages. Thus, again, HTML describes. Javascript can alter that description by altering the HTML in certain ways.
  2. Steve S

    On 2006-08-01 14:07:54


    HTML creates set constant. An tag in HTML will always insert the same image into your website. Scripting languages such as Java allow you to generate dynamic, changing content. Java script allows you to write code that writes HTML code to create different content. The different languages are also run in different places. When someone looks at your web page, the HTML code is sent to them to be interpreted, and the java scripts are run on your server. This means that anyone can see your HTML code (and take it for themselves if they want), but you can see your javascript.