Results 1 to 6 of 6

Thread: How to use JavaScript in HTML page

  1. #1
    Moderator
    Join Date
    Oct 2005
    Answers
    305

    How to use JavaScript in HTML page

    How to use JavaScript in HTML page

    In this JavaScript tutorial you will learn how to use JavaScript in HTML page, how to write output to a page, different places where JavaScript can be paced in HTML, JavaScript in external file and how to place and execute JavaScript in external file.

    Read More...


  2. #2
    Contributing Member
    Join Date
    May 2007
    Answers
    60

    Re: How to use JavaScript in HTML page

    Hi,

    just create a .js file using notepad editor i mean javascript function u bind the javascript file in html using script tag 'src' attribute like


    Ex:

    Example.js
    ----------

    function f1(t)
    {
    if (t.value=' '){
    alert('Text Box shold not be empty')
    }
    }

    Example.html
    -------------












    when ever u click the button it will call the js file f1 funtion it will verify the text box data if it empty it will give the alert message if not nothing will happen.

    do u have any quries let me know......

    Regards,
    Hari Prasad

    Last edited by hari.nattuva; 06-13-2007 at 09:36 AM.

  3. #3

    Re: How to use JavaScript in HTML page

    correct you can use the javascript anywhere of the page


  4. #4

    Re: How to use JavaScript in HTML page








  5. #5

    Re: How to use JavaScript in HTML page

    How to Handle Older Browsers
    Browsers that do not support JavaScript will display the script as page content. To prevent them from doing this, we may use the HTML comment tag:



    The two forward slashes at the end of comment line (//) are a JavaScript comment symbol. This prevents the JavaScript compiler from compiling the line.


  6. #6

    Re: How to use JavaScript in HTML page

    With traditional programming languages, like C++ and Java, each code statement has to end with a semicolon.

    Many programmers continue this habit when writing JavaScript, but in general, semicolons are optional! However, semicolons are required if you want to put more than one statement on a single line.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact