JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2061
Number of posts: 5164

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
how do i use javascript Posted by crazydude007 on 20 May 2006 at 12:24 AM
hi, i am started uasing javasrcipt and i cant get how you use it. i tryied to create a simple web page but it did not work!. "<html>
<head>
<title>JavaScript Test</title>
</head>

<body onLoad="LoadMe()">

<script language="JavaScript">
<!--
function LoadMe() {
var text = "Hello, World!<br>";
for (var i = 0; i < 10; i++) {
document.write(text);
}
document.write("Ten lines of \"Hello, World!\"");
}
//-->
</script>

</body>
</html>" how cant i learn how to use javasrcipt?
Report
Re: how do i use javascript Posted by zibadian on 20 May 2006 at 1:24 AM
: hi, i am started uasing javasrcipt and i cant get how you use it. i tryied to create a simple web page but it did not work!. "<html>
: <head>
: <title>JavaScript Test</title>
: </head>
:
: <body onLoad="LoadMe()">
:
: <script language="JavaScript">
: <!--
: function LoadMe() {
: var text = "Hello, World!";
: for (var i = 0; i < 10; i++) {
: document.write(text);
: }
: document.write("Ten lines of \"Hello, World!\"");
: }
: //-->
: </script>
:
: </body>
: </html>" how cant i learn how to use javasrcipt?
:
Error: <script>-tag should be in the head.
See http://www.w3schools.com/js/ for more info on javascript.
Report
Re: how do i use javascript Posted by freeman_452003 on 8 Jun 2006 at 2:21 PM
: : hi, i am started uasing javasrcipt and i cant get how you use it. i tryied to create a simple web page but it did not work!. "<html>
: : <head>
: : <title>JavaScript Test</title>
: : </head>
: : <script language="JavaScript">
: : <!--
: : function LoadMe() {
: : var text = "Hello, World!";
: : for (var i = 0; i < 10; i++) {
: : document.write(text);
: : }
: :
document.write("Ten lines of \'Hello, World!\'");[/green]
: : }
: : //-->
: : </script>
: : <body onLoad="LoadMe()">[/green]
: :
: :
: : </body>
: : </html>" how cant i learn how to use javasrcipt?
: :
:
GREEN Before you can call for a function you have to declare it. Try this out and see if it works.
PURPLEYou have to change the parenthesis. """" doenst work but "''" does. Mabye that's not what your looking for but I haven't looked through your code to much.
Report
Re: how do i use javascript Posted by mac_doggie on 13 Jun 2006 at 1:39 PM
This message was edited by mac_doggie at 2006-6-13 13:42:23

: : : hi, i am started uasing javasrcipt and i cant get how you use it. i tryied to create a simple web page but it did not work!. "<html>
: : : <head>
: : : <title>JavaScript Test</title>
: : : </head>
: : : <script language="JavaScript">
: : : <!--
: : : function LoadMe() {
: : : var text = "Hello, World!";
: : : for (var i = 0; i < 10; i++) {
: : : document.write(text);
: : : }
: : :
document.write("Ten lines of \'Hello, World!\'");[/green]
: : : }
: : : //-->
: : : </script>
: : : <body onLoad="LoadMe()">[/green]
: : :
: : :
: : : </body>
: : : </html>" how cant i learn how to use javasrcipt?
: : :
: :
: GREEN Before you can call for a function you have to declare it. Try this out and see if it works.
: PURPLEYou have to change the parenthesis. """" doenst work but "''" does. Mabye that's not what your looking for but I haven't looked through your code to much.
:
It's not very nice to place the script tag between the head and the body. (It's not W3C valid that way...) You'd better put it in the head or in the body of your document.

<head>
<title>JavaScript Test</title>
<script language="JavaScript">
<!--
function LoadMe() {
    var text = "Hello, World!";
    for (var i = 0; i < 10; i++) {
      document.write(text);
    }
    document.write("Ten lines of \'Hello, World!\'");
  }
//-->
</script>  
</head>
<body onLoad="LoadMe()">


</body>
</html>


Also. THe function LoadMe() is called in the onload of the body, that means the function is already declared and implemented, so you shouldn't have any trouble executing the function... Do make sure you don't make any mistakes in cApTALs like LOADME() or loadme(), but LoadMe() if you declared the function as function LoadMe()

-mac-
mailto:mac_doggie@hotmail.com
the Netherlands...

BTW >> the first example did work....
And to answer your question... (how cant i learn how to use javasrcipt?)
There are many ways in wich you can't learn JavaScript, but I think you want to know how you can....




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.