![]() ![]() |
| |||||||||
| Hotspots: Slides and Code TA Corner Comments? Announcements FAQ Static Webspace | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
<html> <head> <title> The Simplest Possible Web Page
</title> <script> function countDowntoOne() {
document.write("<ul>");
for(i=100; i<=1; 1--)
{
document.write("<li>Item number:", i);
}
document.write("</ul>");
} </script> </head> <h1>A Simple Heading</h1>
<p>this is a very simple web page.</p> <p><<image
src="mediasources/barbara.jpg"/> </p> <script>
countDowntoOne() </script> </body> </html>
for (i = 100; i >= 1; i--){...}
| Great question! Java is good for serious program development, building programs with thousands or even millions of lines of code. It has features like being able to "protect" variables and methods so that some are private and not directly accessible by other programmers – that way, when programmers share each others' code, programmers don't accidentally break another piece of the program (e.g., object) by modifying critical (private) variables in ways that they're not supposed to be modified. Python is designed for smaller programs with smaller development teams (most often just a single programmer, but maybe a handful of programmers). It's made to be easy to use. Java is harder to use, but the rigor makes it more likely that larger programs can be assembled from smaller parts and work. Does that help? Mark Guzdial |
| Note, though, that the program on this page is JavaScript, not Java. JavaScript looks a lot like Java, but Java has more features and can't be embedded in web pages in the same way as JavaScript. Mark Guzdial |
| It's possible to use JavaScript to control creation of web pages, including access to databases. That's how it's often used on webservers. Mark Guzdial |
| Every 100 ms, the JavaScript function drift is executed, which finds the division "barb" and changes its position by 5 pixels in both the X and Y directions. That's what causes the picture to "drift." Try it! Mark Guzdial |
(i=100; i>=1;i–) and not i++