Custom Search
www.rocket99.com : Technical Guides Sybase Oracle UNIX Javascript


Technical Guides
Sybase
Oracle
UNIX
Javascript




Of Interest

Business Intelligence and Analytics



Oracle Training





Javascript » Methods » Coding »

Javascript: Where it fits in HTML

     



Javascript is typically placed within three areas of a web page:



  • Header Section: Code for functions, and shared variable declaration/initialization.
  • Body Section: Code which executes as the page is loaded, producing output which is woven into the page.
  • End Section: Code which calls initialization routines, e.g. timers.

Below is a code sample which illustrates several techniques:
 
 <html>
 
 <head>
 
 <script language="javascript">
 <!--
 
 function f_timer()
 {
 imageidx ++ ;
 if (imageidx==8)
   {
   imageidx=0
   } ;
 }
 
 // -->
 </script>
 
 </head>
 
 <body>
 <form>
 
 Paragraph 1 : This is some sample text located in the body of the page.<br>
 This example illustrates the ability to embed Javascript calls within the body of a form.
 
 <script language="javascript">
 <!--
 document.write("<hr>" + "This was written by Javascript" + "<hr>");
 // -->
 
 </script>
 
 Paragraph 2 : This is some sample text located in the body of the page.<br>
 This example illustrates the ability to embed Javascript calls within the body of a form.
 
 <script language="javascript">
 <!--
 document.write("<h2>" + "This was written by Javascript also" + "</h2>");
 // -->
 </script>
 
 Paragraph 3 : This is some sample text located in the body of the page.<br>
 This example illustrates the ability to embed Javascript calls within the body of a form.
 
 </form>
 </body>
 
 <script>
 <!--
 timerID = setTimeout("f_timer()", 1000);
 //-->
 </script>
 
 </html>
 
 






Javascript : Related Topics

Javascript : Methods : Incrementing a counter within an edit field
Javascript : Methods : Animation Example
Javascript : Methods : Image Mapping Example
Javascript : Methods : Redirecting Page Access
Javascript : Methods : Loading a new page dynamically
Javascript : Methods : Complex Application with Forms
Javascript : Methods : Image Viewer with Prev and Next Buttons
Javascript : Methods : Array Processing, Frameset Writes
Javascript : Methods : Accessing the cookie file
Javascript : Methods : Using include files
Javascript : Methods : Pure virtual call error
Javascript : Methods : Passing variables to windows
Javascript : Methods : Executing Dynamic Code
Javascript : Methods : Single line edit: Data entry issue
Javascript : Methods : Call CGI counter
Javascript : Methods : Dynamic Objects and Names
Javascript : Methods : Setting Focus to a Control During Load

Sybase Web Site
Sybase iAnywhere Mobile Web Site
Oracle Enterprise Web Site



Get the latest Rocket99 news and tech tips via






Site Index About this Guide to Sybase, Oracle, and UNIX Contact Us Advertise on this site




Copyright © 2016 Stoltenbar Inc All Rights Reserved.