Skip to main content

Simple Program: Displaying a Line of Text in a Web Page

JavaScript uses notations, javascript may appear strange to non-programmers. We begin by considering a simple script that dispalys the text "Welcome to JavaScript Programming!" in the body of an XHTML document. All major web browsers contains JavaScript interpreters, which process the commands written in JavaScript.

The JavaScript code we write will appear in the <head> section. The browser interprets the contents of the <head> section first, so the JavaScript programs we write there execute before the <body> of the XHTML document displays.

Displaying a Line of Text

<html>
  <head>
    <title>A First Program in JavaScript</title>
    <script type = "text/javascript">
      <!--
      document.writeln( "<h1>Welcome to JavaScript Programming!</h1>" );
      // -->
    </script>
  </head>
  <body>
  </body>
</html>

The <script> tag to indicate to the browser that the text which follows is part of a script. The type attribute specifies the type of file as well as the scripting language used in the script-in this case, a text file written in javascript. Both Internet Explorer and Firefox use JavaScript as the default scripting language.

When a browser that does not support scripts encounters the preceding code, it ignores the <script> and </script> tags and the script code in the XHTML comment. Browers that do support scripting will interpret the JavaScript code as expected.(Some browsers require the JavaScript single-line comment // before the ending XHTML comment delimiter(-->) to interpret the script properly.

Popular posts from this blog

List of software companies in Chennai

List of software companies in Chennai India's Information technology is an industry consisting of IT services and business process outsourcing(BPO). In india information technology is playing an important role, IT sector in India is generating more than 3 million employment. IT & ITeS industry in India has grown enormously. Indian Information Technology has made a mark in the world. Many MNC's are started branches in Indian cities like Bangalore, Chennai, Delhi etc,. The below table shows you list of software companies in Chennai. 4i Apps Solutions Pvt Ltd http://www.4iapps.com Abra Technologies http://www.abratechnologies.com Accel Frontline Ltd http://www.accelfrontline.in Adrenalin eSystems Ltd http://www.myadrenalin.com Akmin Technologies Pvt Ltd http://www.akmin.com American Megatrends India Pvt Ltd http://www.amiindia.co.in Anantara Solutions Pvt Ltd http://www.anantsol.com Arrowpoint Technologies Pvt Ltd http://www.arrowpointtechn...

How to use HTML textbox, buttons, checkbox and radio buttons ?

HTML is easy to learn here we are going to create textbox, buttons, checkbox and radio buttons for beginers. In Freshers Blog we gave many example for html programs. Generally textbox, buttons, checkboxs and radio buttons these components will help you to create interactive registration form. Example for textboxs, checkboxs bellow, <html>   <head>     <title>Welcome to Fresher Blog</title>     </head>   <body>     <input type="text" name="text1" ></input>     <input type="checkbox" name="checkbox1">Checkbox 1</input>     <input type="radio" value="Radio">Radio 1</input>     <input type="submit" value="Freshersblog"></input>   </body> </html> The above example beginners can learn html more quickly and easily. Thanks.

Subex Ltd Is Hiring Development Engineer, Bangalore

Role: Development Engineer Company Name: Subex Ltd Engineering Branch: BE/BTech – CS/IS/EEE/E&C/TE/MCA Percentage cut-off: 65% (No backlogs) – aggregate from 10th till Engineering CTC: Rs 4 Lacs fixed +  75k One Time Performance Bonus Job Location: Bangalore Responsibility & Key Result Areas: Coding and Unit Testing using one or more of the following languages/technologies : Core Java, C++, C#, J2EE, GWT, Ruby on Rails (RoR), Unix Scripting, Perl Scripting, PL/SQL etc (Technologies and Languages may vary between Teams/Products assigned to) Responsible for development and implementation of small to medium low-complexity components/units of a product, application or project module. Requires theoretical knowledge of programming languages/technologies and needs to build and demonstrate the practical knowledge of the same over time. Needs to build relevant product and domain knowledge in the areas or teams assigned to work with. Works on problems of lim...