This is the P2PU Archive. If you want the current site, go to www.p2pu.org!
You haven't posted any discussions yet.
When I was trying to learn Javascript at W3schools, Javascript is being taught in the process of making a website (inside an <html> tag or <head> tag, how it would look like in a website, etc.) Here, it's like it's only Javascript and Javascript alone. It was like when I was studying C++ or Visual Basic; it's pure programming. I'm having a hard time trying to see the results of a Javascript code on a website. The main reason I signed up is because I want to learn to use Javascript, then see how it shows on a website. But here, it's like Javascript has nothing to do with making websites at all. I don't know if it's just me, or maybe I'm just missing something.
Hi Ronald, javaScript is a programming language on its own and does nor need to be put into a web page. Yet, today the language is mostly used for web development to provide a more enhanced user interface and for dynamic websites.
So, you can use some of the tools other students mentioned, which does not require to put the code within a Html frame work. But, without much trouble, you should also be able to use the html framework.
Some tools to use for executing your javaScript code
http://jsfiddle.net/
http://www.mozilla.org/rhino/
Test Page
var total=10;
for(var i=0; i
is used to encapsulate the whole page
things you want to declare in this section
title of your page
the actual content of your page
specifies you want to implement jacascript in this section
Hope this helps.
Roland
Hi Ronald,
When we run Javascript in a web page we use the web page as the output channel. When we run Javascript in a console we are using it (the console) as an output channel. We are only changing the output channel so to say.
Very soon in this course, when we come to the document object model, we will be using Javascript within the browser, but to limit our understanding of Javascript only to be used within a browser would be incorrect.
That is the reason we have started this course treating Javascript as a general purpose programming language (which it is becoming now). Very soon we will come to the part which deals with the DOM and then take all that we have learned to write programs to be run in the browser.
I believe Javascript has come a long way and is now being used for purposes beyond browser programming. Even though much of it is beyond the scope of this course, I feel, introducing Javascript as a general purpose programming language is important.
--
Regards
Parag
Ronald, something went missing in my response
html tags
html to encapsulate your whole page
head the header section of your page
title the title of your page
body the actual content of your page
script specifies you want to implement javascript
Look at a few web pages for the correct html and javaScript tags and you should have no problems using them within a web page
Just as an example, here is how we would change the program in which used a loop to print a triangle to write to the browser. Notice that instead of print() we are using document.write(), and because the browser needs a br tag for newline we use that after printing every line.
<html>
<head>
<script type="text/javascript">
function drawTriangle() {
var str = "";
for(var i=0; i<10; i++) {
str += "#";
document.write(str);
document.write("<br/<");
}
}
</script>
</head>
<body onLoad="drawTriangle()">
</body>
</html>