Web Design and Management
Web Design and Management
UNIT - I
Working of Web - HTML Markup for Structure - Creating simple page - Marking up text -
Adding Links - Adding Images - Table Markup - Forms - HTML5
1. 1 WORKING OF WEB
The moment you enter this address in your browser and you hit ENTER, a lot of
different things happen:
The URL gets resolved
A Request is sent to the server of the website
The response of the server is parsed
The page is rendered and displayed
Actually, every single step could be split up in multiple other steps, but for a good
overview of how it all works, that's something we can ignore here. Let's have a look at
all four steps.
Step 1 - URL Gets Resolved
The website code is obviously not stored on your machine and hence needs to be
fetched from another computer where it is stored. This "other computer" is called a
"server". Because it serves some purpose, in our case, it serves the website.
You enter "academind.com" (that is called "a domain") but actually, the server which
hosts the source code of a website, is identified via IP (= Internet Protocol) addresses.
The browser sends a "request" (see step 2) to the server with the IP address you
entered (indirectly - you of course entered "academind.com").
Clients are the typical web user's internet-connected devices (for example, your
computer connected to your Wi-Fi, or your phone connected to your mobile network)
and web-accessing software available on those devices (usually a web browser like
Firefox or Chrome).
Servers are computers that store webpages, sites, or apps. When a client device wants
to access a webpage, a copy of the webpage is downloaded from the server onto the
client machine to be displayed in the user's web browser.
In addition to the client and the server, we also need :
Your internet connection: Allows you to send and receive data on the web. It's
basically like the street between your house and the shop.
TCP/IP: Transmission Control Protocol and Internet Protocol are communication
protocols that define how data should travel across the internet. This is like the
transport mechanisms that let you place an order, go to the shop, and buy your goods.
In our example, this is like a car or a bike (or however else you might get around).
DNS: Domain Name Servers are like an address book for websites. When you type a
web address in your browser, the browser looks at the DNS to find the website's real
address before it can retrieve the website. The browser needs to find out which server
the website lives on, so it can send HTTP messages to the right place (see below).
This is like looking up the address of the shop so you can access it.
HTTP: Hypertext Transfer Protocol is an application protocol that defines a language
for clients and servers to speak to each other. This is like the language you use to
order your goods.
Component files: A website is made up of many different files, which are like the
different parts of the goods you buy from the shop. These files come in two main
types:
o Code files: Websites are built primarily from HTML, CSS, and JavaScript,
though you'll meet other technologies a bit later.
o Assets: This is a collective name for all the other stuff that makes up a
website, such as images, music, video, Word documents, and PDFs.
instead. And the browser tries to pick the best handling mechanism for any data type
it detects.
Step 4 - Page Is Displayed
As mentioned, the browser goes through the HTML data returned by the server and
builds a website based on that.
Though it is important to know, that HTML does not include any instructions
regarding what the site should look like (i.e. how it should be styled). It really only
defines the structure and tells the browser which content is a heading, which content
is an image, which content is a paragraph etc. This is especially important for
accessibility - screen readers get all the useful information out of the HTML structure
Step 5: Change the page appearance with a style sheet: This exercise gives you a taste of
formatting content with Cascading Style Sheets.
Web Pages :
Web pages have many uses. Here are some important facts about why web pages are so useful.
A cheap and easy way to spread information to a large audience.
Another medium to market your business.
Let the world know about you with a personal website!
Hypertext is ordinary text that has been dressed up with extra features, such as
formatting, images, multimedia, and links to other resources.
Markup is the process of taking ordinary text and adding extra symbols. Each of the
symbols used for markup in HTML is a command that tells a browser how to display
the text.
Words to Know :
Tag - Used to specify ("mark-up") regions of HTML documents for the web browser
to interpret. Tags look like this: <tag>
Element - A complete tag, having an opening <tag> and a closing </tag>.
Attribute - Used to modify the value of the HTML element. Elements will often have
multiple attributes.
Paragraphs:
Paragraphs are the most rudimentary elements of a text document. You indicate a paragraph
with the p element by inserting an opening <p> tag at the beginning of the paragraph and a
closing </p> tag after it.
Headings : h1 … h6
It is used to produce section headings for an HTML document. The content of each
heading element is shown on a separate line.
Headings are defined with the <h1> to <h6> tags. <h1> defines the largest heading.
<h6> defines the smallest heading.
<h1>Some common HTML Elements </h1>
<h2> Some Common Formatting elements </h2>
<h3>This is a heading</h3>
Where , Should use h1 for highest level, h2 for next highest, and so on.
<h2 align="left">Left aligned heading</h2>
<h2 align="center">Centered Heading</h2>
<h2 align="right">Right aligned heading</h2>
<li><a href="">Sans-serif</a></li>
<li><a href="">Script</a></li>
<li><a href="">Display</a></li>
<li><a href="">Dingbats</a></li>
</ul>
<h5> Ordered List</h5>
<ol>
<li>Gutenburg develops moveable type (1450s)</li>
<li>Linotype is introduced (1890s)</li>
<li>Photocomposition catches on (1950s)</li>
<li>Type goes digital (1980s)</li>
</ol>
<h5> Description List</h5>
<dl>
<dt>Linotype</dt>
<dd>Line-casting allowed type to be selected, used, then recirculated into
the machine automatically. This advance increased the speed of typesetting and printing
dramatically.</dd>
<dt>Photocomposition</dt>
<dd>Typefaces are stored on film then projected onto photo-sensitive
paper. Lenses adjust the size of the type.</dd>
</dl>
HTML Comments :
A comments begin with string of characters <!-- , which must contain no white space.
A comment ends with the string --> , again with no spaces.
For example ,
<!--Here is the comment text-->
Nesting Elements :
If one element is nested within another element, then the content of the inner element
is also content of the outer element is called nesting elements.
< tt> <strong> Horizontal rule </strong> </tt>
Most HTML elements are either block or inline
Block: browser automatically generates line breaks before and after the
element content
Ex: p,div
Inline: element content is added to the “flow”
Ex: span, tt, strong, a
<nav>
<ul>
<li><a href="">Previous</a></li>
<li><a href="">Next</a></li>
</ul>
</nav>
</footer>
</article>
Addresses
Last, and well, least, is the address element that is used to create an area for contact
information for the author or maintainer of the document. It is generally placed at the end of
the document or in a section or article within a document. An address would be right at home
in a footer element.
<address>
Contributed by <a href="../authors/robbins/">Jennifer Robbins</a>,
<a href="http://www.oreilly.com/">O'Reilly Media</a>
</address>
SPECIAL CHARACTERS
There are two ways of referring to a specific character: by an assigned numeric value (numeric
entity) or using a predefined abbreviated name for the character (called a named entity). All
character references begin with an “&” and end with a “;”.
A link has two ends, called anchors. The link starts at the source anchor and points to the
destination anchor, which may be any web resource, for example, an image, an audio or
video clip, a PDF file, an HTML document or an element within the document itself, and so
on.
Anything between the opening <a> tag and the closing </a> tag becomes the part of the link
that the user sees and clicks in a browser. Here are some examples of the links:
Example:
<a href="https://www.google.com/">Google Search</a>
<a href="https://www.tutorialrepublic.com/">Tutorial Republic</a>
<a href="images/kites.jpg">
<img src="kites-thumb.jpg" alt="kites">
</a>
The href attribute specifies the target of the link. Its value can be an absolute or relative URL.
An absolute URL is the URL that includes every part of the URL format, such as protocol, host
name, and path of the document,
e.g., https://www.google.com/, https://www.example.com/form.php, etc. While, relative
URLs are page-relative paths, e.g., contact.html, images/smiley.png, and so on. A relative URL
never includes the http:// or https:// prefix.
Example:
<!DOCTYPE html>
<html>
<head>
<title>links</title>
</head>
<body>
<a href="https://www.w3schools.com/">Visit W3Schools.com!</a><br><hr>
<a href="https://www.w3schools.com/" target="_blank">Visit W3Schools!</a><br><hr>
<h2>Absolute URLs</h2>
<p><a href="https://www.w3.org/">W3C</a></p>
<p><a href="https://www.google.com/">Google</a></p><br>
<h2>Relative URLs</h2>
<p><a href="html_images.asp">HTML Images</a></p>
<p><a href="/css/default.asp">CSS Tutorial</a></p><br>
<a href="mailto:[email protected]">Send email</a><br><hr>
<a href="https://www.w3schools.com/html/" title="Go to W3Schools HTML section">Visit
our HTML Tutorial</a>
</body>
</html>
OUTPUT:
Visit W3Schools.com!
Visit W3Schools!
Absolute URLs
W3C
Google
Relative URLs
HTML Images
CSS Tutorial
Send email
and can compress this type of image, so they take up to 4 times less than the GIF format images.
The files that contain photos JPEG format have the extension “. jpg”.
To add an image to an HTML document, you need to include the <img> tag concerning the
desired image. The <img> tag is an empty element i.e., it does not require a closing tag, and
you can use it to include small icons to large Images. The syntax of the <img> tag can be given
below:
Syntax: <img src=“dog.jpg” alt=“alternative text”>
Every image needs to carry at least two attributes: the src attribute and an alt attribute.
Src: The letters “src” stand for “source”. It defines the URL of the image. It identifies the
specific image to use with its type, i.e., it not only specifies what image; it also specifies the
URL of the image file. The commonly used image file types are GIF (Graphics Interchange
Format), JPEG (Joint Photographic Experts Group).
Alt: The “alt” attribute stands for “alternative”. Whereas, the alt attribute gives a text
description of the image inserted. This attribute is useful in text-only browsers, where images
turned off to load files faster. With this attribute, visitors will get the image’s text description
if it cannot be displayed for some reason.
For graphical browsers (Internet Explorer, Netscape Navigator, etc.), the alternative text
appears as the pop-up text i.e., whenever the visitor hovers the mouse over the image, the
alternative text appears within a rectangular box. The following lines of code describe how to
include an image with alternative text on a web page.
Various Attributes Used With <img> Tag
Height and Width: These attributes are used to set the dimensions of an image. The values
of these attributes are interpreted in pixels by default. The value from 1 to 100 percent. You
are specifying dimensions of an image decrease the loading time and improve the overall
appearance of the page. You first decide the image size, which will be most appropriate for
your web page, and then include that image.
In most of the browsers, these attributes get precedence over the actual image size. When a
browser starts loading a page, it first notes these attributes and leaves that much space for the
image before it displays the remaining text. Ultimately it goes back and fills in the image.
In the absence of these attributes, the browser first loads enough of the image to know how
much space that image requires, and tell then the rest of the page might not be displayed. To
specify the dimensions to make your page load faster because it becomes easier for the
browser.
Syntax: <img src="/images/dogs.jpg" height="pixels" width="pixels">
Another use of “height” and “width” attributes would be to size images. It is rarely a good
idea, as the image may end up distorted. One way to avoid distortion is to shrink images
proportionally. Shrinking the image with these attributes does not affect the file size while
resizing the image beforehand will shrink the file and reduce the download time. However,
these are two drawbacks to specifying the “height” and “width”.
• These are presentational attributes. So they ideally belong in a style sheet instead of in your
<img> tag.
• If you have a small image and specify its height and width, the Navigator
and Internet Explorer, won’t fit the alternate text inside the small image box for those users
not displaying images.
The speed advantage of setting the “width” & “height” attributes may out weight the two
drawbacks, especially if you are not using small images with a lot of alternate text.
You might also use the style attribute to define width and height for those images. It prevents
style sheets from altering the image size unintentionally since the inline style has the
maximum priority.
Align: HTML provides another appearance attribute called the “align” attribute using which
you can position your image on the web page. This attribute offers both horizontal and vertical
alignment options. It can take any of the five values left, right, top, middle, and bottom.
Syntax: <img src=“url” align=“left | right | top | middle | bottom”>
Horizontal Alignment: Horizontally image can align to the left or right of the window.
Left: Images by default align to the left, with any text following the image appearing on the
same line. However, if the text is long, then it wraps to the bottom of the image. Specifying
align = “left” forces the image to the current left margin and any accompanying text appears
on the same line around the image’s right margin. Its interpretations also depend on whether
any images or other material with left alignment appear earlier or not. In that case, former
material will get preference, and later image will appear on the former one’s right. Any text
preceding the image forces it to appear on the next line.
Right: It is similar to left except that image is forced to the right margin, and any
accompanying text appears on the same line around the image’s left margin. In the following
example, you will see how the “to align” attribute works. Here the same image is included
thrice to show you all the possible horizontal alignments.
As you can see in the output, the first image has default alignment, which forces the long
surrounding text to appear at the bottom of the image, whereas specifying the alignment lets
the surrounding text appear beside the image.
Vertical Alignment: Vertically image can align to the top, middle, and bottom of the window.
Top: Aligns the top of the image with the top of the current text, and the remainder of the
image hangs below the text line.
Middle: Aligns the vertical mid-line of the image to the current baseline of the surrounding
text.
Bottom: This is the default vertical alignment that aligns the bottom of the image with the
accompanying text’s baseline. The remainder of the image remains higher than the
surrounding text setting.
Border: By default, no border appears around an image unless that image is a link. However,
you can specify a border for an image using the “border attribute in <img> tag.
Syntax: <img src=“url” border=“pixels”>
The width of the border is specified in pixels. If you use the border = “1” attribute in <img>
tag, then a thin border will appear around the image. Also, you can increase the border width
by increasing the value in the border attribute.You can hide the border by specifying border
=” 0″ to the <img> tag.
To add a border to the image, simply add this attribute in <img> tag.
Syntax: <img src=“d:\dog.jpg” alt=“A dog sitting on the grass” border=“10”>
An image’s border width does not count towards determining. an image’s height or width. So
if you specify an image to be 100pixels wide (width = “100”) and have a border width of 10
(Border=” 10″) then the image will take 120 pixels of horizontal space (because the border
appears on both the left and right sides of the image).
The image will also take a few pixels more than 120 because browsers will put a small amount
of space between an image and text. The amount of space allocated is determined by the
HSpace and VSpace attributes.
4. VSpace and HSpace: Internet Explorer and Navigator do not place images right next to
the text. Instead, they put a small margin of a few pixels in between text and an image. You
can control the amount of horizontal space with the HSPACE attribute and the vertical space
with the VSpace attribute.
These spaces also referred to as white space. White space doesn’t need to be white; it just
means space has color, which depends on the background. Including white space around
images makes the page’s overall appearance better.
Syntax: <img src=“drl” hspace=“pixels”vspace=“pixels”>
The “HSpace” attribute used to insert a buffer of horizontal space on the left and right
of an image while the “VSpace” attribute is used to insert a buffer of vertical space between
the top and bottom of the image and other objects.
The value of both attributes should be a positive number of pixels. Simultaneously,
under some browsers, it may be possible to set the attribute values to percentage values. It is
inadvisable because very high values may produce strange results. By default, these attribute
values are small, non-zero numbers, which provide just enough space to keep the surrounding
text away from the image.
As you can see, there is a text written before the <img> tag, and it forces the image to
appear in a new line. Specifying white space keeps the surrounding text away from the image.
Figure 8-3 shows the elements that identify the table (table), rows (tr, for “table row”), and
cells (th, for “table headers,” and td, for “table data”). Cells are the heart of the table, because
that’s where the actual content goes. The other elements just hold things together.
Spanning Cells
One fundamental feature of table structure is cell spanning, which is the stretching of a
cell to cover several rows or columns. Spanning cells allows you to create complex table
structures, but it has the side effect of making the markup a little more difficult to keep track
of. You make a header or data cell span by adding the colspan or rowspan attributes.
Column spans:
Column spans, created with the colspan attribute in the td or th element, stretch a cell
to the right to span over the subsequent columns (Figure). Here a column span is used to make
a header apply to two columns. (added a border around cells to reveal the table structure in the
screenshot.)
<table>
<tr>
<th colspan="2">Fat</th>
</tr>
<tr>
<td>Saturated Fat (g)</td>
<td>Unsaturated Fat (g)</td>
</tr>
</table>
Row spans:
Row spans, created with the rowspan attribute, work just like column spans,
but they cause the cell to span downward over several rows. In this example,
the first cell in the table spans down three rows (Figure 8-8).
<table>
<tr>
<th rowspan="3">Serving Size</th>
<td>Small (8oz.)</td>
</tr>
<tr>
<td>Medium (16oz.)</td>
</tr>
<tr>
<td>Large (24oz.)</td>
</tr>
</table>
1.7 FORMS
HTML forms are used to allow a user input data on a webpage and pass data to a server.
A form can contain input elements like text fields, checkboxes, and radio-buttons, submit
buttons and more. A form can also contain select lists, text area, field set, legend, and label
elements.
Forms are a vital tool for the webmaster to receive information from the web surfer,
such as: their name, email address, credit card, etc. A form will take input from the viewer and
depending on your needs, you may store that data into a file, place an order, gather user
statistics, register the person to your web forum, or maybe subscribe them to your weekly
newsletter.
Input fields are going to be the meat of your form's sandwich. The <input> has a few attributes
that you should be aware of.
type - Determines what kind of input field it will be. Possible choices are text, submit,
and password.
name - Assigns a name to the given field so that you may reference it later.
size - Sets the horizontal width of the field. The unit of measurement is in blank spaces.
maxlength - Dictates the maximum number of characters that can be entered.
HTML - Password Fields:
Password fields are a special type of <input /> tag. All that we need to do is change the
type attribute from text to password.
HTML – Checkbox Forms:
Checkboxes are another type of <input /> form. We set the type attribute to check and
we also must set a name and value attribute for them to be at all helpful.
HTML - Radio Forms :
Radios are types of input forms that allow a user to pick an either/or type of selection.
In order to achieve this, we must properly name each radio button selection accordingly. These
types of forms must be named.
HTML – Textareas :
Textareas retrieve "blog" type information from the user. Paragraphs, essays, or memos
can by cut and pasted into textareas and submitted. Textareas have an opening and a closing
tag, any words placed between them will appear inside your text area.
HTML - Upload Forms :
Use an upload form to allow users to upload pictures, movies, or even their own
webpages. An upload form is another type of input form, simply set the type attribute to file.
HTML - Selection Forms and Drop Down Lists :
Drop down lists are the basic selection forms. You have probably seen them already on
the internet, maybe filling out a personal profile and selecting the state in which you live. Drop
down lists have several options a user can select.
HTML - Selecting Multiples
We can further add to our selection forms by adding the multiple attribute. This allows
the user to select more than one entry from your selection forms. Obviously this attribute does
not work with the single drop down lists.
HTML - Submit Buttons :
Submission buttons are a type of <input /> tag. Set the type attribute to submit. This
creates a special type of button in your forms that will perform the form's set action.
HTML Reset Buttons:
Reset buttons exist to reset the fields of your form. These are handy for very large forms
and the user is having difficulty or simply needs to start filling in the form from scratch.
HTML - Hidden Field :
Hidden fields are not displayed by the browser, there are a number of uses for them.
When dealing with forms you will usually find yourself using some sort of database
mechanism: MySQL, SQL Server, or maybe just a plain text file. In any case use hidden forms
to pass along information to your database that may have already been received from the user.
In this rare case, a hidden form field may come in handy.
For Eg. :
1. STUDENTS REGISTRATION FORM
<!DOCTYPE html>
<html>
<head>
<title>HTML FORMS</title>
</head>
<body>
<h2>STUDENTS REGISTRATION FORM</h2>
<hr width="400" align="left">
<table width="400">
<tr>
<td height="30">Name of student</td>
<td><input type="text"></td>
</tr>
<tr>
<td height="30">Name of father</td>
<td><input type="text"></td>
</tr>
<tr>
<td height="30">Age</td>
<td><input type="number" min="1" max="65"></td>
</tr>
<tr>
<td height="30">Date ofb birth</td>
<td><input type="date"></td>
</tr>
<tr>
<td>gender</td>
<td>
<input type="radio" name="gender" value="male">
<label>male</label>
<input type="radio" name="gender" value="female">
<label>female</label>
</td>
</tr>
<tr>
<td>city</td>
<td>
<select>
<option selected>chennai</option>
<option>canada</option>
<option>mumbai</option>
</select>
</td>
</tr>
<tr>
<td>languages known</td>
<td>
<input type="checkbox" name="l1">
<label>English</label>
<input type="checkbox" name="l2">
<label>hindi</label>
<input type="checkbox" name="l3">
<label>tamil</label>
</td>
</tr>
<tr>
<td height="50" align="center">
OUTPUT:
EXAMPLE 2:
<form method="post" action=mailto:[email protected]>
Name: <input type="text" size="10" maxlength="40" name="name"><br>
Password: <input type="password" size="10" maxlength="10" name="password
Soccer: <input type="checkbox" name="sports" value="soccer" checked="yes” />
Italian<input type="radio" name="food" checked="yes" />
<textarea cols="20" rows="5" wrap="hard/soft/off"> hello welcome</textarea>
<input type=”hidden” name=”MAX_FILE_SIZE” value=”500”>
<input type=”file”> // for upload a file
<select size=3>
1.8 HTML 5
HTML5 is the fifth version of HTML. This version was released in 2014. HTML5
comes with new and advanced features. It allows developers to build animations and simple to
complex applications that run on the browser.
HTML5 can help developers build web apps, which are developed for Entertainment,
Online streaming, Video players, Audio players, etc.
In the previous versions, for video playback and drag-and-drop features, users had to
depend on third-party browser plug-ins, like Adobe Flash. However, HTML5 offers all these
features to the users along with many other new features and HTML attributes for building
attractive websites. Almost all web browsers, including Google Chrome, Safari, Mozilla
Firefox Microsoft Edge, and mobile browsers, such as Android and iOS support most of
the HTML5 features.
Key Features of HTML5
Cleaner code structure
Plain and simple Doctype declaration: <!DOCTYPE html>
Audio and video tags
Cross-browser compatibility
Canvas for animation and game development
Offline browsing
Geolocation support
Improved semantics
Improved storage
Provides search engine optimization benefits
It is an extension of html4. It is
Version It is the 4th version of HTML.
the 5th version of HTML.
Canvas API
In Html5 <canvas> tag introduced, canvas is a rectangular area in HTML page. The <canvas>
tag is used to draw graphics using JavaScript. It is a container for graphics. Inside this container,
graphics are drawn using JavaScript. Canvas has different methods for boxes, paths, circles,
characters and adding images. By default, it has no border and no content.
Example:-
<canvas id="canvas1" width =”600” height= “500”> hello update the your
browser</canvas>
The id attribute is used to refer the canvas in the javascript and width and height are used to
define the size of the canvas.
<!DOCTYPE html>
<html>
<header>
</header>
<body>
<h3>hello demo</h3>
<canvas id="canid" width="600" height="400">Update your browser chrome</canvas>
<script>
var tempcan=document.getElementById(“canid”);
var tempcan2=tempcan.getContext("2d");
tempcan2.fillStyle='#0000ff';
tempcan2.fillRect(25,25,180,100);
</script>
</body>
</html>
OUTPUT:
(such as rotate() and scale()), plus attributes for applying styles (for example, lineWidth,
strokeStyle, fillStyle, and font).
Figure shows the simple smiley face we’ll be creating with the Canvas API.
<!DOCTYPE html>
<html>
<header>
</header>
<body>
<h3>hello demo</h3>
<canvas width="600" height="400" id="my_first_canvas">
Your browser does not support HTML5 canvas. Try using Chrome,
Firefox, Safari or Internet Explorer 9.
</canvas>
<script type="text/javascript">
window.addEventListener('load', eventWindowLoaded, false);
function eventWindowLoaded() {
canvasApp();
}
function canvasApp(){
var theCanvas = document.getElementById('my_first_canvas');
var my_canvas = theCanvas.getContext('2d');
my_canvas.strokeRect(0,0,200,225)
// to start, draw a border around the canvas
//draw face
my_canvas.beginPath();
my_canvas.arc(100, 100, 75, (Math.PI/180)*0, (Math.PI/180)*360, false);
// circle dimensions
my_canvas.strokeStyle = "black"; // circle outline is black
my_canvas.lineWidth = 3; // outline is three pixels wide
my_canvas.fillStyle = "yellow"; // fill circle with yellow
my_canvas.stroke(); // draw circle
my_canvas.fill(); // fill in circle
my_canvas.closePath();
// now, draw left eye
my_canvas.fillStyle = "black"; // switch to black for the fill
my_canvas.beginPath();
my_canvas.arc(65, 70, 10, (Math.PI/180)*0, (Math.PI/180)*360, false);
// circle dimensions
my_canvas.stroke(); // draw circle
my_canvas.fill(); // fill in circle
my_canvas.closePath();
// now, draw right eye
my_canvas.beginPath();
my_canvas.arc(135, 70, 10, (Math.PI/180)*0, (Math.PI/180)*360, false);
// circle dimensions
my_canvas.stroke(); // draw circle
my_canvas.fill(); // fill in circle
my_canvas.closePath();
// draw smile
my_canvas.lineWidth = 6; // switch to six pixels wide for outline
my_canvas.beginPath();
my_canvas.arc(99, 120, 35, (Math.PI/180)*0, (Math.PI/180)*-180, false);
// semicircle dimensions
my_canvas.stroke();
my_canvas.closePath();
// Smiley Speaks!
my_canvas.fillStyle = "black"; // switch to black for text fill
my_canvas.font = '20px _sans'; // use 20 pixel sans serif font
my_canvas.fillText ("Hello Canvas!", 45, 200); // write text
}
</script>
</body>
</html>
----------------------------------------------------------------------------------------------------------------