1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

JavaScript Java or JavaScript

Discussion in 'Web Development' started by ishkey, Aug 21, 2008.

  1. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    So... what is the difference between Java and JavaScript anyway?
    Java is an Object Oriented Programming (OOP) language created by James Gosling of Sun Microsystems. JavaScript was created by the fine people at Netscape. JavaScript is a distant cousin of Java. It is also an OOP language. Many of their programming structures are similar. However, JavaScript contains a much smaller and simpler set of commands than does Java. It is easier for the average weekend warrior to understand.

    The main difference is that Java can stand on its own while JavaScript must be placed inside an HTML document to function. Java is a much larger and more complicated language that creates "standalone" applications. A Java "applet" (so-called because it is a little application) is a fully contained program. JavaScript is text that is fed into a browser that can read it and then is enacted by the browser.

    Java must be compiled into what is known as a "machine language" before it can be run on the Web.
    JavaScript is text-based. You write it to an HTML document and it is run through a browser. You can alter it after it runs and run it again and again. Once the Java is compiled, it is set. Sure, you can go back to the original text and alter it, but then you need to compile again.
    Java applets run independent of the HTML document that is calling for them.

    The delivery of the applet is done through a download. The HTML document calls for the application, it downloads to the user's cache, and waits to run. JavaScript is wholly reliant on the browser to understand it and make it come to life.

    So, what are the benefits of using one over the other? There are several. If you can understand Java, it is amazingly versatile. Because of the size and structure of the language, it can be used to create anything from small Web page events to entire databases to full browsers.

    JavaScript's main benefit is that it can be understood by the common human. It is much easier and more robust than Java. It allows for fast creation of Web page events. Many JavaScript commands are what are known as Event Handlers: They can be embedded right into existing HTML commands. JavaScript is a little more forgiving than Java. It allows more freedom in the creation of objects.

    Java is very rigid and requires all items to be denoted and spelled out. JavaScript allows you to call on an item that already exists, like the status bar or the browser itself, and play with just that part. JavaScript is geared to Web pages. Java is geared toward where it is needed most at the time.
     
  2. eVentureBiz

    eVentureBiz New Member

    Great description of the two, ishkey. In college I learned how to program in C++ (another OOP language). The concept can be difficult to grasp but if you learn it, you can do some pretty cool stuff.

    Thanks for the details. I've stumbled this page for others to see.
     
  3. pandreson

    pandreson New Member

    Java-based platform-independent tools for data and performance visualization are an integral part of the VPL. Pablo SDDF trace files generated by the Pablo performance instrumentation system are used for postmortem performance visualization.The Virtual Programming Laboratory is a Web-based virtual programming environment built based on a client-server architecture.
    ----------------------------------------
    pandreson

     
  4. reganstar

    reganstar New Member

    Extra good description. Thank you ishkey .
     
  5. GDSweb.ca

    GDSweb.ca Moderator/Developer

    The only problem I find with JS is that quite a few people turn this function off in their browsers......hence not allowing the script to function, and not letting the user view what should be there.

    that's the only downside for me.....
     
  6. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    Contrary to the old days when you required the following script -
    Most all browsers have it turned on.

    Most pages are transforming into Ajax (shorthand for asynchronous JavaScript and XML), http://en.wikipedia.org/wiki/Ajax_(programming)
    If you use any search engine, guess what, you use some form of java/javascript.

    The W3 Schools data says 90%, other users say that they get over 99% on their site. You can always try to test this yourself by setting a cookie in JS and seeing if the cookie ever reappears in subsequent page requests.

    Note that many of the current "fancy" stats packages (like Google Analytics) use javascript includes on the page. So they don't even track non-javascript users!

    Finally check your your server logs?
     
  7. GDSweb.ca

    GDSweb.ca Moderator/Developer

    My browser shows JS, I was just pointing out one possible downside=)

    But thanks for the great info and advice!
     
  8. maryjohn

    maryjohn New Member

    Hey JAVA Guys..

    JavaScript and Java
    Although the names are almost the same, JavaScript isn't the same as Java. These are two different techniques for Internet programming. Java is a real programming language, and you can create real programs with it.

    JavaScript is a scripting language. You could even say that JavaScript is rather an extension to HTML than a separate computer language. It's so tightly integrated with HTML that you could call it "JavaScript markup language." JavaScript coders don't care too much about real programming, they just make different nice effects by inserting small JavaScript code fragments into their Web pages.

    The drawbacks of JavaScript
    Right now the biggest problem is the imperfect JavaScript implementations that today's browsers offer. Although all major browsers that are version 3.0 or higher include JavaScript support, they deal with JavaScript differently.

    In fact, different versions of the same browser handle JavaScript differently. This makes it difficult to create a complicated JavaScript code that work across all browsers. So always check your pages on as many different browsers (and even platforms) as possible.

    What do JavaScript code look like?
    Like HTML, JavaScript is just text that can be typed into a text editor. Its code is embedded in HTML within a <SCRIPT> tag. Some old browsers don't understand this tag. To prevent them from treating your JavaScript as HTML, always use this trick involving HTML comments...

    Code:
    <script type="text/javascript">
    <!-- hide JavaScript code from old browsers
    YOUR SCRIPT HERE
    // end the hiding comment -->
    </script>


    Here's an example of JavaScript code that prints current date in the top right corner of your Web page...
    Code:
    <html>
    <head>
    <script type="text/javascript">
    <!--
    function PrintDate() {
    today = new Date();
    document.write('Date: ', today.getMonth()+1, '/', today.getDate(), '/', today.getYear());
    }
    //-->
    </script>
    </head>

    <body>
    <p align="right">
    <script type="text/javascript">
    <!--
    PrintDate();
    //-->
    </script>
    </p>
    THE REST OF YOUR PAGE.
    </body>
    </html>

    .:)
     
  9. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    Old news - let's get real here and warp forward in time abit to say today. IE6 came out in 2001, ver8 is now out. If you still are on 3,4,5,6 you need a reality check. Even MS has conceded and change their ways. I just upgraded to Opera 10, it came out a couple days ago.
    In one camp is IE which still has a couple of fixes to go - In the other camp Firefox, Opera, Chrome, Safari and others no problem here. Gone are the days of of the IE hacks needed to implement your code.
    If you disagree then tell me why is Google App Engine based off of Eclipse and Java SDK.
    Platfoms Windows, XP and up and servers - MAC and Linux, no problem here.
    About the only hack you will find now is one for a couple minor ways the two camps handle code in a css file.
    If you are really worried about all the browser then let us not forget the <noscript> tag, this way we can cover all the verisions and the select few who do not have java turned on in their browser.
     
  10. hoola

    hoola New Member

    Thanks guys for nice post.
     
  11. bear costume

    bear costume New Member

    Java or JavaScript Description

    Thanks for the details. Its really good
     
  12. fairfax

    fairfax New Member

    I want to create and laod IFrame in my page through JavaScript any help.

     
  13. Armando J. Davis

    Armando J. Davis New Member

    Check out this code that I made
    <html>
    <head>
    <script type="text/javascript">
    function LoadFrame() {
    iframe = document.createElement("IFRAME");
    iframe.setAttribute("src", "http://google.com/");
    iframe.style.width = 640+"px";
    iframe.style.height = 480+"px";
    document.body.appendChild(iframe);
    }
    </script>
    </head>
    <body>
    <a href="#" onMouseDown="LoadFrame()">View Frame </a>
    </body>
    </html>
    please tell is it working fine or not.
    Thank you
     
  14. hmerrillb b

    hmerrillb b New Member

    thanks nice one...
     
  15. daviddakarai

    daviddakarai Member

    Thanks for the info.
     
  16. Hello Dear

    Java


    - Java allows you to play online games, chat with people around the world, calculate your mortgage interest, and view images in 3D, just to name a few. It's also integral to the intranet applications and other e-business solutions that are the foundation of corporate computing.
    - Java language are development by software.
    - Java Development kit are source of the java.

    Java Script

    - Java script is a high level dynamic and interpreted programming language.
    - Alongside HTML and CSS it is one of the three esential technologies of world wide web content production
    - Supported by all modern web browsers with out plug-ins
    - improve your extra java script knowledge visit w3schools.com learning site
     
  17. nidhivyas

    nidhivyas Member

    Java is independent platform language.
    Java script is a scripting language.
    They require different plug-ins.
    Java code need to be compile while java script code are in text.
     
  18. healthcareinfo

    healthcareinfo New Member


    Wow Awesome Post Sharing very useful Post...!!!
     
  19. aegisinfoways

    aegisinfoways New Member


    Java and Javascript deference best information sharing for this post.this post very useful for web development.

    Thanks.
     
  20. w3web

    w3web Member

    With Java we can code for server side and client side programs, where as Java script is for client side validations purpose. Js is a scripting language and java is a platform independent language that runs in any OS.