Best Windows Hosting

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg
Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Wednesday, 25 July 2012

How to create dynamic tables in HTML using javascript at runtime?

Posted on 18:46 by Unknown
In this tutorial, you will come to know how to create dynamic tables in HTML. There are some situations when you don't know the contents of the table at design time while creating the table. In this condition, you want to load and fill the table at run time. Here in this code we will write javascript code to create the table at runtime.

Code Snippet

<!DOCTYPE html>
<html>
<head>

<script type="text/javascript">
function CreateTable()
{
    var tablecontents = "";
    tablecontents = "<table>";
    for (var i = 0; i < 5; i ++)
   {
      tablecontents += "<tr>";
      tablecontents += "<td>" + i + "</td>";
      tablecontents += "<td>" + i * 100 + "</td>";
      tablecontents += "<td>" + i * 1000 + "</td>";
      tablecontents += "</tr>";
   }
   tablecontents += "</table>";
   document.getElementById("tablespace").innerHTML = tablecontents;
}
</script>

</head>

<body onload="CreateTable()">
<h1>My First Web Page</h1>
<p id="tablespace"></p>
</body>
</html>


Explanation: Here in this code snippet, in the body of the html page, there is a <p> tag in which we want to place a table at runtime. So, we are calling a javascript function 'CreateTable' on the load of page. It will create table at runtine and will change the innerHTML of <p> tag at runtime.
Read More
Posted in Javascript | No comments

Friday, 11 May 2012

Window Object in Javascript: Properties and Methods

Posted on 08:57 by Unknown
1 The Window object is the top level object and represents the window of the browser.

2. Window objects are either the current window (if the browser is displaying only a single document), or those created with a window.open() method (where the name is specified in the code), or separate frames, if the document is laid out using a <FRAMESET> definition (where the windows are named in the <FRAME> element).

3. As the Window object is the top level object in the object hierarchy and the existance of the current window is assumed, most Window properties need not be prefixed by Window. For example, the following two references are identical :

window.defaultStatus
defaultStatus

and would both return the default text of the status bar for the current window.

4. Difference between Window and Documnet Objects:

Window is the first thing that gets loaded into the browser. The document object is your html document that will be loaded into the browser. The Document object provides access to all HTML elements in a page, from within a script. The document actually gets loaded inside the window object. The Document object is a part of the Window object, and can be accessed through the window.document property.

Window Objecy Properties

closed: Returns a Boolean value indicating whether a window has been closed or not
defaultStatus: Sets or returns the default text in the statusbar of a window
document: Returns the Document object for the window
frames: Returns an array of all the frames (including iframes) in the current window
history: Returns the History object for the window
innerHeight: Sets or returns the inner height of a window's content area
innerWidth: Sets or returns the inner width of a window's content area
length: Returns the number of frames (including iframes) in a window
location: Returns the Location object for the window
name: Sets or returns the name of a window
navigator: Returns the Navigator object for the window
opener: Returns a reference to the window that created the window
outerHeight: Sets or returns the outer height of a window, including toolbars/scrollbars
outerWidth: Sets or returns the outer width of a window, including toolbars/scrollbars
pageXOffset: Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window
pageYOffset: Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window
parent: Returns the parent window of the current window
screen: Returns the Screen object for the window
screenLeft: Returns the x coordinate of the window relative to the screen
screenTop: Returns the y coordinate of the window relative to the screen
screenX: Returns the x coordinate of the window relative to the screen
screenY: Returns the y coordinate of the window relative to the screen
self: Returns the current window
status: Sets the text in the statusbar of a window
top: Returns the topmost browser window

Window Object Methods

alert(): Displays an alert box with a message and an OK button
blur(): Removes focus from the current window
clearInterval(): Clears a timer set with setInterval()
clearTimeout(): Clears a timer set with setTimeout()
close(): Closes the current window
confirm(): Displays a dialog box with a message and an OK and a Cancel button
createPopup(): Creates a pop-up window
focus(): Sets focus to the current window
moveBy(): Moves a window relative to its current position
moveTo(): Moves a window to the specified position
open(): Opens a new browser window
print(): Prints the content of the current window
prompt(): Displays a dialog box that prompts the visitor for input
resizeBy(): Resizes the window by the specified pixels
resizeTo(): Resizes the window to the specified width and height
scroll(): Scrolls the window
scrollBy(): Scrolls the content by the specified number of pixels
scrollTo(): Scrolls the content to the specified coordinates
setInterval(): Calls a function or evaluates an expression at specified intervals (in milliseconds)
setTimeout(): Calls a function or evaluates an expression after a specified number of milliseconds

Read More
Posted in Javascript | No comments
Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • 13 Things to keep in mind before using DLL in Delphi
    Keep in mind the following tips when writing your DLL: 1. Make sure you use the proper calling convention (C or stdcall). 2. Know the correc...
  • How to use TADOTable in Delphi XE2?
    Following is the code snippet which will show you how to use TADOTable in Delphi XE2? procedure TClass1.GetDataFromADOTable; begin   try    ...
  • How to use FindComponent function in Delphi XE2?
    Following is the code snippet which will show you how to use FindComponent in Delphi XE2? procedure TClass1.UseFindComponent(FieldName : str...
  • Online Finance Degrees
    There is a great demand for professionals with profound knowledge of finance and accounting in most of the reputed banks and financial insti...
  • How to grab the recruiter’s attention with your resume?
    Did you know that the average recruiter spends about 8 to 10 seconds glancing at your resume before s/he moves on to the next? So, whether y...
  • 5 ways to handle workload at your workplace
    With bigger workloads, tighter deadlines and more pressure, the temptation to pack in as many tasks as possible is hard to resist. But juggl...
  • Online Marketing Degrees
    Because global competition has become so intense, it should come as no surprise that companies invest heavily in their marketing and promoti...
  • Frameset, Frame and IFrame Elements in HTML
    Frame Element With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and...
  • Oracle Streams: An Overview
    Oracle Streams enables information sharing. Each unit of shared information is called a message. The stream can propagate information within...
  • Phonegap: An amazing combination of HTML5, CSS3 and Javascript
    Phonegap (Cordova) = HTML5 + CSS3 + Javascript What a great combination!! How easy is Phonegap to learn!!! A great enhancement in mobile tec...

Categories

  • AJAX
  • C++
  • CSS
  • Delphi
  • DOTNET
  • HTML
  • Javascript
  • jQuery
  • Management
  • Online Degrees
  • Oracle
  • Others
  • Phonegap
  • PHP
  • Unix
  • XML

Blog Archive

  • ▼  2012 (155)
    • ▼  September (64)
      • Online Music Degrees
      • Online Accredited Degrees
      • Online Advertising Degrees
      • Online Finance Degrees
      • Online Marketing Degrees
      • Online Forensic Science Degrees
      • Online DBA (Database Administrator) Degrees
      • Online Biology Degrees
      • Online Geography Degrees
      • Online History Degrees
      • Online Art Degrees
      • Online Sports Degrees
      • Online Agriculture Degrees
      • Online Library Science Degrees
      • Online Environmental Science Degrees
      • Online Business Degrees
      • Online Physical Education Degrees
      • Online Science Degrees
      • 5 Tips to enjoy your workplace
      • 5 E-mail Etiquette You Must Know
      • How to grab the recruiter’s attention with your re...
      • 30 Facts About Google Adsense You Must Know
      • Working of the JSP Container
      • List of 70 basic commands of UNIX
      • 13 Point comparison between SQL and PLSQL
      • 10 Rules of Operator Overloading in C++
      • 6 Point comparison between Apache and IIS Web Servers
      • 5 Qualities of a good manager
      • Never try to fake your Resume / CV
      • How to write a cover letter of your resume?
      • The crucial first 5 minutes of an Interview
      • Rejected in an Interview? Don't Lose Your Heart
      • 6 FAQ’s in an interview
      • 5 ways to get into the good books of the boss
      • 5 Reasons to Quit Your Job
      • Online Web Designing Degrees
      • Online BBA Degrees
      • Online MA Degrees
      • Online BA Degrees
      • Online Human Resource (HR) Degrees
      • Online Graduate Degrees
      • Online Master Degrees
      • Online Fashion Design Degrees
      • Online Bachelor Degrees
      • Onlin PhD Degrees
      • Online Nursing Degrees
      • Online MBA Degrees
      • Online Doctorate Degrees
      • Online Psychology Degrees
      • Online Social Science Degrees
      • Online Law Degrees
      • Online Accounting Degrees
      • Online Medical Degrees
      • Online Engineering Degrees
      • Online Professional Degrees
      • 3 Things to keep in mind while you quit your job
      • Planning a job change? Tips to negotiate salary
      • How to use SaveToFile and LoadFromFile in Delphi XE2?
      • How to use TADODataset, TDatasource and TDBGrid in...
      • Embarcadero HTML5 Builder Features List
      • 5 ways to handle an interview over a video call
      • List of 8 job interview goof-ups
      • Anatomy of the commonly asked interview question “...
      • Use Social Networking Sites To Groom Your Career
    • ►  August (11)
    • ►  July (4)
    • ►  June (3)
    • ►  May (25)
    • ►  April (48)
Powered by Blogger.

About Me

Unknown
View my complete profile