Nice book written by Scott Duffy.
Few quotations i wanted to share from this book from the remaining chapters of the book.
1) XPath is a simple yet powerful language for addressing parts of an XML document. For instance, you would use the following XPath expression to access the first form element on an XHTML web page.
2) What if we wanted to add a small JavaScript script to the page that will constantly keep the time updated to the correct time?We can use the DOM document object to modify the contents of the web page.
<script language="JavaScript" type="text/javascript">
function update_time() {
// The current date and time
var rightnow = new Date();
// Capture the hours as a string, "00" thru "23"
var hours = rightnow.getHours();
if (hours < 10)
var hourstring = "0" + hours.toString();
else
var hourstring = hours.toString();
// Capture the minutes as a string, "00" thru "59"
var minutes = rightnow.getMinutes();
if (minutes < 10)
var minutestring = "0" + minutes.toString();
else
var minutestring = minutes.toString();
// Capture the seconds as a string, "00" thru "59"
var seconds = rightnow.getSeconds();
if (seconds < 10)
var secondstring = "0" + seconds.toString();
else
var secondstring = seconds.toString();
// Put it all together, "00:00:00"
var timestring = hourstring + ":" +
minutestring + ":" +
secondstring;
// Manipulate the DOM, display it to the screen!
var timeplace = document.getElementById("time");
timeplace.childNodes[0].nodeValue = timestring;
}
</script>
<body onload="update_time()">
<h2>The time now is: <span id="time">00:00:00</span></h2>
</body>
3) The position property places an element in a static, relative, absolute or fixed position.
Example
h1
{
position:absolute;
left:100px;
top:150px;
}
Possible Values
| Value | Description |
|---|---|
| static | Default. An element with position: static always has the position the normal flow of the page gives it (a static element ignores any top, bottom, left, or right declarations) |
| relative | An element with position: relative moves an element relative to its normal position, so "left:20" adds 20 pixels to the element's LEFT position |
| absolute | An element with position: absolute is positioned at the specified coordinates relative to its containing block. The element's position is specified with the "left", "top", "right", and "bottom" properties |
| fixed | An element with position: fixed is positioned at the specified coordinates relative to the browser window. The element's position is specified with the "left", "top", "right", and "bottom" properties. The element remains at that position regardless of scrolling. Works in IE7 (strict mode) |
About the Author
Scott Duffy has been providing IT consulting services to medium- and large-sized businesses and government organizations for more than six years. Before embarking on a career as a consultant, Scott worked at two of the largest corporations in Canada as a software developer.His 12 years of professional experience cover a wide range of platforms and technologies, including programming in mainframe, client-server, and web-based application environments. He is actively involved in every stage of the software development process, including team
management.
When he’s not designing software applications for clients, Scott keeps himself busy with his writing projects. He is currently working on his next book for McGraw-Hill/Osborne, a study guide for the Microsoft MCSD 70-300 exam.
To contact Scott to discuss your organization’s business needs, or about any other matter,please e-mail him at scott.duffy@mydemos.com or visit his web site at http://www.mydemos.com.
Hope you enjoy reading this book.
No comments:
Post a Comment