Goodies to Go ™
January 19, 2004–Newsletter #268
This newsletter is part of the internet.com network.
http://www.internet.com
Featured this week:
* Goodies Thoughts – An Object Lesson
* Q & A Goodies
* News Goodies
* Goodies Peer Reviews
* Feedback Goodies
* Windows Tech Goodies
* And Remember This…
Goodies Announcement
The new Beyond HTML Goodies book
is now available!
Go beyond the basics
and learn how the pros add and use dynamic HTML features and advanced
JavaScript techniques. Beyond HTML Goodies demonstrates dozens of new and
different features readers can add to their existing Web pages using HTML and
JavaScript. The book starts with simple text and image tips, such as adding a
clock to a Web page or causing text to appear when the mouse moves over an
image. It gradually builds to more complex tricks, including manipulating forms
or working with cookies behind the scenes. Throughout the book, readers enjoy
Joe’s snappy style and “to the point” discussion of each “goody” in the book.
http://books.internet.com/books/0789727803
Goodies Thoughts – An Object Lesson
One plus one equals two. Seems simple enough. It is, and it
conveys a certain amount of useful information. Actually, it conveys some
fundamentally essential information, but that’s not really my point! Here’s
another way of looking at it:
Two is a number. It is a whole number. It is one digit long. It can be derived
by the addition of one and one.
There’s still the same information there, but presented a little differently,
and with the addition some extras. There’s nothing in the extras that you didn’t
already know, but that’s because you knew it, not because it was presented in
the original statement.
In the old days (excuse me a moment while I grab my corncob pipe and pull the
wicker rocker out onto the front porch), computer programming was all much like
the first statement. A series of instructions began at the start of a problem
solution and continued in linear fashion to the end of the solution. There was
some jumping from point to point and there were some looped routines that would
be performed a few times, but the basic model was linear.
Then along came the concept of "Object Oriented Programming" ("OOP"). The
example above is a very crude illustration of the concept of Objects in OOP.
Instead of two merely being seen as the result of the addition of one and one,
it is seen as an object with its own properties and value. Those of you who are
familiar with OOP are probably saying to themselves that Vince is nuts if he
thinks he can describe OOP with such a simple illustration, but describing OOP
is not my aim here. I thought a quick explanation of the idea of an "Object"
would be in order because I have seen the term used a lot recently, especially
in discussion of JavaScript, without any description of what is meant by it, and
with the assumption that the reader, who may be fairly new to web development
and to programming, already knows what it is. Last week’s newsletter was just
such an example.
An object is, in a sense, a container that can hold both data and program code.
In addition to a value (like 2 is the value of the "result" object described
above) an object can have properties (like data-type and length) and "methods".
A "Method" is actually a piece of program code contained within the object that
does something for you with the data that is contained within the object. In
last week’s newsletter (see
https://www.htmlgoodies.com/letters/267.html) I talked about the "go" method
of the "history" object. This method is some code that takes a value you pass to
it as a parameter (I used a value of -2 in one example) and uses it as an index
into data entries in the history object (the data entries constitute a list of
addresses, or URLs, of web pages that have been visited) and takes the browser
to the requested page.
This little bit of JavaScript is a will show you the various properties
associated with an object, in this case, "location":
<html>
<head>
</head>
<body>
<script language="javascript">
for (prop in location) {
document.write("location." + prop + " = " + location[prop] + "<br>");
}
</script>
</body>
</html>
Put this into an html file, save it, and open it in your browser (don’t forget
to edit out the periods – see the note in Q&A, below, about code in this
newsletter)
There are sometimes several properties and methods associated with objects and
the documentation for the object should describe them and their uses. Often,
there are more methods available that aren’t mentioned in the particular
reference material you may be using. Discovering these methods is always a fun
and interesting thing to do. They are also quite often very useful! Take a look
at the new material about Dates and Times on the HTML Goodies website, for
example.
Thanks for Reading!
– Vince Barnes
Q & A Goodies
Questions are taken from submissions to our Community Mentors. You can ask a Mentor a question by going to
https://www.htmlgoodies.com/mentors.
Q. I have some stand
alone HTML program that reside in multiple laptop computers located in my
client’s fleet of vehicles. I am attempting to find a program or script that
will act as a hit counter so I can analyze the traffic and identify the pages or
sections visited or more importantly, those that are not.
A. You might find that cookies would provide the feedback you are looking
for. Take a look at this HTML Goodies page:
http://htmlgoodies.earthweb.com/beyond/cookiecount.html
Q. I would like to be able to create clickable buttons at the top of my
page to link to different places further down the page.
A. Add this link code to your button image:
<a href="#link1"><img src="yourbuttonname.gif"></a>
Then where you want it to link to, add this anchor code:
<a name="link1"></a>
When you click the button it will jump down on the same page to the anchor.
Q. I have a folder, and inside that folder is a webpage and images used
on the webpage. There is another folder inside that folder, and inside this
folder is another webpage. I want to use the images from the previous folder. Is
it possible to link them in locally? Or do I have to use an absolute link?
A. You can link to documents in other directories by specifying the
relative path from the current document to the linked document. For example, a
link to a file "my_file.html" located in the subdirectory "files" would be:
<A HREF="files/my_file.html">My File</A>
If you wanted to reference an image in another folder you can use relative paths
also. For instance your page resides in a folder named "pages" and you want to
reference the image that is in another folder named "images". Both folders
reside on the site in the same level. The reference would look like this:
<img src="../images/my_image.jpg">
This tells the browser to look up into another folder named "images" [The two
dots mean "my parent folder" – Ed].
If the page were in a folder named "folder2" and this folder was in the folder
named "pages" the reference could look like this:
<img src="../../images/my_image.jpg">
This tells the browser to look two folders up for another folder named "iamges".
These are called relative links because you are specifying the path to the
linked file relative to the location of the current file. You can also use the
absolute pathname (the complete URL) of the file, but relative links are more
efficient in accessing a server. By using relative links you make your site more
portable. You can do all of your work building your website on your local
computer and when you upload the entire site to the server, all of the links
will work. If you use absolute links then you run into the problem of having the
files still linked to your local computer.
Q. How do I move stuff where I want it on my website? I put the html in
the scripts area but when I go to my site everything is in the top left corner.
A. By default, text and images will be placed at the top and to the left.
There are tags for positioning, and stylesheets give more control. Sometimes
tables are used for precise layout. I suspect tables would be the most useful
thing for you right now, so have a look at the tables tutorials. https://www.htmlgoodies.com/tutors/tbl.html
Q. How do I make animated GIFs?.
A. Basically, you make each frame as a separate image, and your graphics
application combines them into one file. Imageready can do this. Shareware sites
may have Microsoft GIF Animator, which I’ve used and works adequately. There
will be other applications for animating GIFs. Probably shareware sites like
Nonags and Tucows are your best bet. If you’re willing to learn Flash or
Livemotion, they make animations which are smoother and smaller.
Q. Can you use Visual Basic for making banners?
A. Visual Basic is not the program you should be using for creating
banners. Take a look at PhotoShop (http://www.adobe.com)
or Paint Shop Pro(http://www.jasc.com)
Q. What function returns the square root of a number?
A. That would be Math.sqrt(arg) where arg is your numeric variable. There
is a whole list of Math Object methods in Joe’s book starting at the bottom of
P159.
News Goodies
Infravio, HP Expand Web Services Platforms
[January 19, 2004] Companies say cross-platform application
integration is easier now that Infravio has ported its web
services management tool to HP’s NonStop Platform.
Click
here to read the article
Dell Delving Deeper Into Networking
[January 19, 2004] New switches are aimed at small, medium, and larger
businesses.
Click here to read the article
New Java Widgets For Eclipse
[January 19, 2004] A new plug-in gives Java tool programmers at the IBM-led
consortium a user interface for Web application development, but leaves
NetBeans out.
Click here to read the article
Mozilla Swims With ‘SeaMonkey’ Browser
[January 16, 2004] The 1.6 release improves performance as the disparity
between open source and proprietary platforms continues to grow.
Click here to read the article
Cyberspace, The Next Battlefield
[January 16, 2004] Is World Cyber War I somewhere on the horizon? A new
report shows the increased popularity of converged networks like VoIP makes
it more likely.
Click
here to read the article
AOL Sales Staff Meeting Tapes Reveal Internal Turmoil
[January 16, 2004] Audiotapes of recently departed ad sales head’s meetings
shed light on division’s problems.
Click here to read the article
Big Memory, Itty-Bitty Chips
[January 16, 2004] Intel’s experiments with nanotechnology
grow, as it collaborates with Nanosy on future chips.
Click here to read the article
AOL Mulls Options in Playboy Case
[January 16, 2004] The ISP has three choices after an appeals court
rules that an ad-related trademark case against its Netscape subsidiary can
proceed.
Click here to read the article
Report: Users Giving up on their Desktops
[January 16, 2004] Say good-bye to your desktop. By 2006, only 45
percent of corporate users are expected to consider their desktop to be
their primary information device, according to a new report.
Click here to read the article
E-Rate Probe Focuses on Chicago
[January 16, 2004] A Congressional panel wants to know more about possible
equipment stockpiling by Chicago public schools.
Click here to read the article
Every week a site is selected for review. Each week,
reviews of the previous week’s selected site are chosen for
publication on the HTML Goodies website.
The current week’s selected site is published in Goodies To
Go and in the Peer Reviews section of the website.
Current contact email addresses for submitting your site and
for submitting reviews are published in Goodies To Go.
If you would like to have your site reviewed, sign up for
the Goodies To Go newsletter in the Navigation Bar on the
left side of this page.
For full details about this program, see
https://www.htmlgoodies.com/peerreviews
Did you ever wish your newsletter was an easy two way communications medium?
Ploof! It now is!
If you would like to comment on the newsletter or expand/improve on something
you have seen in here, you can now send your input to:
mailto:nlfeedback@htmlgoodies.com
We already receive a lot of email every day. This address will help us sort out
those relating specifically to this newsletter from all the rest. When you send
email to this address it may wind up being included in this section of the
newsletter, to be shared with your fellow readers.
Please don’t send your questions to this address.
They should be sent to our mentors: see
https://www.htmlgoodies.com/mentors/
For those who are missing Peer reviews: we are once again
revising the Peer review program in the hopes of creating a
workable solution. The current plan is to move the new Peer
Review pages into place in the new year. All those who have
been selected for reviews in the past will be featured in
the new pages. The new method will make it much easier for
your peers to provide feedback and much easier for us to
handle the publication side of things. "Watch this space!"
It’s coming soon!!
Thanks for pointing out the error in the first question in
last week’s Q&A. For those who wanted to get the actual
answer, it’s repeated as the first question in this issue;
this time with the corresponding answer!
Thanks again for all your feedback!
Top
Windows Tech Goodie of the Week:
Code in Style with ASP.NET Themes
http://www.15seconds.com/issue/040105.htm
Thiru Thangarathinam shows how easy it is to customize a .NET
Web
application’s visual appearance at the site, page, or control
level using
ASP.NET 2.0 Themes.
*** And ***
Converting Our "Tell A Friend" Sample to a User Control
http://www.asp101.com/articles/john/tellafriendcontrol/default.asp
In this article I outline the basic steps that are required to
convert an
ASP.NET Web Form to an ASP.NET User Control. I then apply them
to our Tell
a Friend ASP.NET sample code and wouldn’t you know it… I end
up with a
Tell a Friend ASP.NET User Control.
Top
And Remember This . . .
On this day in…
1915 First Air-raid on Britain
On this day in 1915 two German zeppelin airships dropped bombs on
Great Yarmouth and King’s Lynn on the east coast of England. The
zeppelin was a steel framed airship invented by Ferdinand Graf von
Zeppelin in 1900. Three were used in that first air raid, but one
didn’t reach its target because of mechanical problems. The zeppelin
was a huge ship and required hydrogen gas, rather than helium, to
lift its great weight. The flammability of hydrogen turned out to be
a bit of a problem, later on!
Today was also the day that: in 1840 the Charles Wilkes
expedition discovered Antarctica; 1915 George Claude patented
the Neon Tube; 1955 the game "Scrabble" made its debut;
1957 the USSR performed an atmospheric nuclear test; 1966
Indira Ghandi was elected India’s 3rd Prime Minister; 1970 a
Dutch Bishop said he was in favor of married priests; 1971
the Beatles "Helter Skelter" was played at the Charles Manson trial;
Born today were: in 570 Islamic prophet Mohammed; 1736
steam engine inventor James Watt; 1807 General-in-Chief of
the Confederacy Robert Edward Lee; 1809 author Edgar Allen
Poe; 1813 engine inventor Sir Henry Bessemer; 1877
actor Charles Coburn; 1907 actress Lilian Harvey; 1917
singer John Raitt (father to Bonnie); 1920 5th UN Secretary
General Javier Pirez de Cuillar (Peru); 1923 actress Jean
Stapleton; 1935 actress Tippi Hedron; 1942 English
actor Michael Crawford; 1943 singer Janis Joplin; 1946
singer Dolly Rebecca Parton; 1949 singer Robert Palmer;
1953 actor Desi Arnaz Jr.; 1966 Swedish tennis player
Stefan Edberg; 1967 actress Christine Tucci; 1971
actor Shawn Wayans;
Thanks for reading Goodies to Go!