Lecture 4
Lecture 4
Domain name
Using a link
Using an embed tag
Using the bgsound tag
Using CSS elements
Linking to a sound
<head>
<title>Incorporating sound effects</title>
</head>
<body>
<span style = "play-during: url(moo.wav) mix">
<a href = "moo.wav">cow</a>
<!--
bgsound tag works only in MSIE
-->
<bgsound src = "moo.wav">
<!--
embed tag has its own problems
-->
<embed src = "moo.wav"
height = "50"
width = "100" />
<br />
<img src="planets.gif"
width="145" height="126"
usemap="#planetmap">
<area shape="rect"
coords="0,0,82,126"
alt="Sun"
href="sun.htm">
<area shape="circle"
coords="90,58,3"
alt="Mercury"
href="mercur.htm">
<area shape="circle"
coords="124,58,8"
alt="Venus"
href="venus.htm">
</map>
</body>
</html> view page in browser
See the coordinates
<html>
<body>
<p>
Move the mouse over the image, and look at the status bar to see how the
coordinates change.
</p>
<p>
<a href=“image2.html">
<img src="planets.gif"
ismap width="146" height="126">
</a>
</p>
</body>
</html>
view page in browser
Example: Uses the mouse to control the environment
<html>
<!-- mouseOver.htm -->
<html>
<head>
<title>Basic mouse over effects</title>
</head>
<body>
<h1>Basic mouse over effects</h1>
<a name = "dummy" />
onMouseOver = "document.theButton.src =
'clickMeDn.png'"
onMouseOut = "document.theButton.src =
'clickMeUp.png'"
>
<img src = "clickMeUp.png"
name = "theButton"
height = "80"
width = "300"
border = "0" /> view page in browser
</a>
</body>
</html>
CS 3520: Web Development
on to programming…
Introduction to Styles and Properties
CSS styles are created with two parts separated by a colon: the
property, which refers to a specific CSS style, and the value
assigned to it, which determines the style’s visual
characteristics
<body>
<table style="font-family:Arial,sans-serif">
<caption style="color:red;
font-style:italic;
text-decoration:underline">
Student data. </caption>
<tr style="background-color:red">
<th> name </th> <th> age </th>
</tr>
<tr>
<td> Chris Smith </td> <td> 19 </td>
</tr>
<tr>
<td> Pat Jones </td> <td> 20 </td>
</tr>
<tr>
<td> Doogie Howser </td> <td> 9 </td>
</tr>
</table>
</body>
</html> view page in browser
Document style sheets
inline style sheets apply to individual elements in the page
▪ can lead to inconsistencies as similar elements are formatted differently
e.g., might like for all H1 elements to be centered
</body>
</html> view page in browser
Document style sheets (cont.)
<html>
<!-- style05.html -->
document style sheets are
<head>
<title> Inline Style Sheets </title> especially useful in
<style type="text/css">
table {font-family:Arial,sans-serif}
formatting tables
caption {color:red;
font-style:italic;
text-decoration:underline}
th {background-color:red}
effectively separates
</style> content from presentation
</head>
<body>
<table>
<caption> Student data. </caption>
what if you wanted to right-
<tr><th> name </th> <th> age</th></tr> justify the column of
<tr><td> Chris Smith </td> <td> 19 </td></tr>
<tr><td> Pat Jones </td> <td> 20 </td></tr> numbers?
<tr><td> Doogie Howser </td> <td> 9 </td></tr>
</table>
</body> what if you changed your
</html>
mind?
view page in browser
Pseudo-elements
<html>
<!-- style06.html --> pseudo-elements are used to
<head>
address sub-parts of elements
<title>Title for Page</title>
<style type="text/css"> ▪ can specify appearance of link in
a {color : red; various states
:visited :active :hover
text-decoration : none;
font-size : larger} ▪ can specify format of first line in page
a:visited {color : black} or paragraph
a:active {color : orange} :first-line
a:hover {color : blue}
p:first-letter {font-size : large; ▪ can specify format of first letter in
color : white; page or paragraph
background-color : darkblue} :first-letter
</style>
</head>
</body>
</html>
view page in browser
How to show the creation date and URL information
<html>
<!-- style08.html -->
<head>
For your assignment,
<title>JavaScript preview</title>
</head>
you need to show the
<body> date and URL of the
<TABLE width="100%" border=0>
<TBODY>
website
<TR>
<TD align=left>
<SCRIPT language=JavaScript> The page's location and
document.write("<font size=- last modification date
1><i>"+document.location+"</i></font>");
</SCRIPT> should be automatically
displayed at the bottom.
<TD align=right>
<SCRIPT language=JavaScript>
View the source for this
document.write("<font size=- Web page and cut-and-
1><i>"+document.lastModified+"</i></font>"); paste the appropriate text
</SCRIPT>
</TR></TBODY>
into your page in order to
</TABLE> accomplish this.
</body>
</html>
http://www.mcs.csuhayward.edu/~bhecker/CS-3520/Assignments/Assign1.doc