Home » Archive

Articles in the Study JavaScript Category

Study JavaScript, Tech Corner »

[1 May 2009 | No Comment | Posted By:Lloyd]

Previous
I found a few more things which am posting in here.This is the continuation of JavaScript OBJECTS
Date Objects
These are used to work with date,day,month,year,time etc.
Eg:1(To get the current date)
<html>
<body>
<script type=”text/javascript”>
document.write(”Todays date:-”+Date( ));
</script>
</body>
</html>
Eg:2(To get the day of a week)
<html>
<body>
<script type=”text/javascript”>
var d=new Date();
document.write(”Today it is ” + d.getDay( ));
</script>
</body>
</html>
The above Eg: can be improvised a bit,check the Eg: below.
In Eg:2 the getDay( ) method returns an integer value equivalent to the day,in the Eg:3 it is more specific.
Eg:3
<html>
<body>
<script type=”text/javascript”>
var d=new Date();
var weekday=new Array(7);
weekday[0]=”Sunday”;
weekday[1]=”Monday”;
weekday[2]=”Tuesday”;
weekday[3]=”Wednesday”;
weekday[4]=”Thursday”;
weekday[5]=”Friday”;
weekday[6]=”Saturday”;
document.write(”Today is ” + weekday[d.getDay()]);
</script>
</body>
</html>
Eg:4 (Clock)
<html>
<head>
<script type=”text/javascript”>
function showTime()
{
var today=new Date();
var …

Read the full Post »

Study JavaScript, Tech Corner »

[14 Apr 2009 | No Comment | Posted By:Lloyd]

Previous
JavaScript study Continued….
Special Symbols in JavaScript
A backslash ( \ ) is used to add special symbols or characters in a javascript.The special symbols are quotes,newlines,tabs etc etc.
Eg:1(check difference between both codes)
document.write(”welcome to “ooty” nice to meet you”);
document.write(”welcome to\”ooty\” nice to meet you”);
Given below is a list of special characters that can be added to a text string with the help of a backslash sign.
\’ Single quote
\” Double quote
\n …

Read the full Post »

Study JavaScript, Tech Corner »

[8 Apr 2009 | One Comment | Posted By:Lloyd]

Goto Prev Next
JavaScript study continued. . . . .
PopUp Boxes
There are three types of popup boxes
1)Alert
Is used to make sure the user is interacting properly and also to make sure information comes through the user.
Eg:1(to show alert popup box)
<html>
<head>
<title>Untitled Page</title>
<script type=”text/javascript”>
function display_alert()
{
alert(”I am an alert popup box”+’\n’+”and this is how line breaks are used”);
}
</script>
</head>
<body>
<div>
<input type=”button” onclick=”display_alert()” value=”Show ME” />
</div>
</body>
</html>
2)Confirm
This is used when we want the user to confirm,or if we want him to accept something.This popup will come with 2 options OK or CANCEL.
Eg:2(Confirm popup box)
<html>
<head>
<title>Untitled Page</title>
<script type=”text/javascript”>
function display_confirm()
{
var loy=confirm(”Press …

Read the full Post »

Study JavaScript »

[1 Apr 2009 | One Comment | Posted By:Lloyd]

JavaScript is a scripting language,designed to add interactivity to an html page.
The official name of javascript is ECMA script .ECMA-262 is the official JavaScript standard.The standard is based on JavaScript (Netscape) and JScript (Microsoft).
How to put javascript into an HTML,??
To insert a JavaScript into an HTML page, we use the <script> tag.Inside the
<script> tag we use the type attribute to define the scripting language.
Eg:1
<body>
<script type=”text/javascript”>
document.write(”Hello World!”);
</script>
</body>
JavaScripts can be put in <head> section or <body> also.JavaScripts in the body part will be executed onlt when the page loads.JavaScripts in the head …

Read the full Post »