www.webdeveloper.com
Results 1 to 4 of 4

Thread: Extension

  1. #1
    Join Date
    Apr 2009
    Posts
    5

    Extension

    Hi all,

    I am a beginner learning JavaScript.

    I have typed my entire program in notepad the following is the coding :

    html>
    <head>
    <title> JavaSCript Addition Of 2 Numbers
    </title>
    </head>
    <body>
    <script type="text/javascript">
    var x,y,z;
    x=5;
    y=10;
    z=x+y;
    document.write("The Addition of 2 numbers is : ");
    document.write(z);
    </script>
    </body>
    </html>

    Now with what extension should I save the above file?

    If I save the above file with .js extension I am getting a dialog box stating that the error : File is undefined.

    But when the above file is saved with the .html extension it is working very well.

    So can anybody tell me whether saving it withthe extension .html is correct or not?

    If it is wrong then what should I do to execute my JavaScript files using the .js extension?

    Please help me.

    Thanks in advance!!

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    With .html or .htm
    Use this basic template:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <title>Basic HTML</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    <script type="text/javascript">
    
    </script>
    
    <style type="text/css">
     
    </style>
    
    </head>
    <body>
    
    </body>
    </html>

  3. #3
    Join Date
    May 2009
    Posts
    2

    HTML extension

    Hello,

    HTML is correct.

    tzah.




    My Websites:
    בניית אתרים

    ניוזלטר

    קניון וירטואלי

  4. #4
    Join Date
    Apr 2009
    Posts
    5
    Your replies have clarified my doubts.

    Thanks all for your prompt reply..

    Thanks a lot..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles