html with javascript - how use javascript in html

JavaScript is provide dynamic environment to html page.javascript add with html page by <script> tag. A complete web page minimum combine three language. HTML  +css  +javascript   =real   interactivity.

you can put <script> element,anywhere in your web page but it's generally considered bad practice to put them anywhere. <head> element of your page is a perfect place to do that.

you can put <script> tag bottom of your web page this can helpfull to increase you web page speed.

add javascript code to html page:

       <html>
           
            <head>
            
    <script type="text/javascript">
                     
     function  click(){document.write("this is the java_script demo");}</script>
     
   </head>   
                   
   <body> <input type="button" name="click" value="please click" onclick="click()"/> 
                     
    <body>
                   
  <html>

note :- html <script> tag has closing tag </script>


javascript external file combine with html page using link element:--see

<head>
    
       <link  rel="javascript"    href="url path for javascript files" />
       
        <script type = "text/javascript"  src="./javascriptfile.js"></script>
<head>

html <noscript> element:-

html <noscript> element body content will only displayed if scripts are not supported, or script disabled in the user's browser.

                 <noscript> your browser not support  the scripting language <noscript>