Tuesday, December 3, 2024

Goodies to Go ™
April 21, 2004– Newsletter #229


Goodies to Go ™
April 21, 2004–Newsletter #229

This newsletter is part of the internet.com network.
http://www.internet.com
 


Featured this week:

* Goodies Thoughts – The Time has Come
* Q & A Goodies
* News Goodies
* Goodies Peer Reviews

* Feedback Goodies  
* And Remember This

 


 

Goodies Announcement

Just in case you missed
it before, 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
The Time has Come




It’s that time again! Or is it? Sometimes it’s difficult to tell what the time
is, or how much of it has passed since a particular point in time. That’s
frequently a problem. We’re in luck, however, when we’re on a web page, because
at that point in time we can use some features that will help us to know exactly
how much time is passing. I’m talking, of course, about JavaScript timers.

JavaScript timers are pretty useful for timing various actions on a web page. A
common use would be for rotating advertising banners or messages on a page. I’m
sure that you can think of many useful things to do with a timer without my
prompting, so let’s forge ahead and see what this timer is and how to use it.

The JavaScript function we are going to use is the function:
window.setTimeout ()
There are two parameters we can use with this function. The first one says what
to do, and the second says how long to wait before doing it. The first can be a
single statement, a collection of statements separated by semicolons and
enclosed in quotes, or the name of a function defined elsewhere on the page. The
second is a value measured in milliseconds, so that 10000 would be ten seconds.

The best way to describe how to use it is with an example. This example is a
tribute to the father of symbolic logic, Charles Dodgson, also known as Lewis
Carroll, author of Alice in Wonderland and Alice Through the Looking Glass.

Here’s the page:

<html>
<head>
<script language="javascript">
function speakwalrus()
{
document.write("<h1>&quot;The time has come,&quot; the Walrus said, &quot;to
speak of many things.&quot;<h1>");
}
</script>
</head>
<body onload="window.setTimeout(‘speakwalrus()’, 9000)">
<h1>
The Walrus and the Carpenter<br>
Walked on a mile or so,<br>
And then they rested on a rock<br>
Conveniently low:<br>
And all the little Oysters stood<br>
And waited in a row.<br>
</h1>
</body>
</html>

On this page, I first define a JavaScript function named "speakwalrus" that
writes out a document to the browser including the line the Walrus speaks. In
the body of the page, I use the page "onload" event to start my timer, with a
first parameter telling it to execute the "speakwalrus" function, and a second
parameter telling it to wait nine seconds before doing so. The body of the page
is the verse of the poem that precedes the famous quotation.

Very simple, very useful!

I should point out that the use of "&quot;" in the Walrus’ spoken piece is to
provide the quotation marks around the actual spoken parts. the document.write
statement itself is a single statement ending after the close parenthesis, at
the semicolon. The semicolons in "&quot;" are part of the mechanism for
including the quote character in a string, not statement separators as mentioned
in the third paragraph, above.

For those who would like to read the whole poem from "Alice through the Looking
Glass", I found this link:
http://www.rivendale.net/miscellanea/walrus.html
 




Thanks for Reading!
– Vince Barnes


 

Top

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 want to open a new window with some adjustments. The problem is that
the window is loaded on the left side of the browser-window. Is it possible to
load the window on the right side?

A. You need to add the left and top properties to your window.open
statement.
This example will place the window 30 pixels from the top and left edge of the
screen:
window.open("si, ‘newwin’, config=’height=500, width=300, toolbar=no, menubar=no,
scrollbars=yes, resizable=yes, location=no, directories=no, status=no, left=30,
top=30");

Q. I am having trouble putting your Perl/cgi guestbook script on my
website. It gives the following error – The requested URL was not found on this
server. When I check the error log it says:
[Mon Apr 14 06:36:53 2003] [error] [client 24.243.131.31] script not found
or unable to stat:
/usr/local/psa/home/vhosts/cowgirlproducts.com/cgi-bin/guestbook.cgi
I have checked everything they say to check:
1) transfer in ASCII
2) check the URL of Perl
3) check the URL to my sites’ cgi-bin (I can’t put the full URL or the error log
says it is duplicated and can’t find the URL – so I must merely use the /cgi-bin/guestbook.cgi)
4) check to make sure there are no margins in the cgi script (not sure how to do
this in Notepad, but I have tried the standard way and also tried to change the
page to "user defined" and change it to landscape and I don’t see where it cuts
off anything. When I check page setup and try to change margins to 0 – it will
not do it.)
5) chmod – changed to the recommendations
The one thing I notice is that when I transfer the guestbook.cgi – it transfers
as guestbook.cgi.txt – but when I try to rename it without the extra – .txt, it
changes to a windows icon and it still doesn’t work. When I try to set my
guestbook.html to point to the guestbook.cgi.txt – it doesn’t work either. I
figure it must be the script itself and I changed it somehow though I copied it
exactly – so I don’t know what else to do. Can you help me?

A. I think you are on the right track when you mentioned the .txt
extension. You were right to change the name from guestbook.cgi.txt to
guestbook.cgi. Don’t worry about the windows icon. That’s just a way for Windows
to associate the file with a specific program. In this case the program to be
run will be perl – on your host’s server, not your personal computer.
Try it again. Rename the file to guestbook.cgi and upload it to your cgi-bin
directory in ASCII text format. It should work.


Q.
I am working with a button on my page:
<STYLE>
.start {font-size: 8pt; color:#ffff00; background:#cc3333}
.end {font-size: 8pt; color:#cc3333; background:#ffff00}
</STYLE>
<SCRIPT LANGUAGE="javascript">
function highlightButton(s) {
if ("INPUT"==event.srcElement.tagName)
event.srcElement.className=s
}
</SCRIPT>
The above is placed above </head>
Then the <FORM></FORM> lines are placed where I need them to be below <BODY>
<FORM NAME=highlight onMouseover="highlightButton(‘start’)" onMouseout="highlightButton(‘end’)">
<INPUT TYPE="button" VALUE="Hot Computer Deals Of The Week!" onClick="location.href=’http://www.tigerdirect.com/email/kb/promo.asp?ID=1671’">

</form>
I would like the button to start out as it appears for onMouseout="highlightButon(‘end’)"
When the page loads, it is the standard grey default size button. Using
<STYLE></STYLE> I now have some control over the button size by specifying
font-size: 8pt; Of course, nothing happens until the cursor is passed over the
button.
I tried some [ onload= ] ideas that didn’t work. Is there a way to control the
initial appearance of the button?

A. I added a class attribute to the INPUT tag. I just used one of the
classes you had already set in your styles, but you can create another one. The
javascript helps with the changes.
<form name="highlight" onmouseover="highlightButton(‘start’)" onmouseout="highlightButton(‘end’)">
<input class="end" type="button" value="Hot Computer Deals Of The Week!" onclick="location.href=’http://www.tigerdirect.com/email/kb/promo.asp?ID=1671’"
/>
</form>
I’m not sure which version of HTML you are using… I’m used to writing in XHTML
1.0, so I’ve made the tags lowercase and added a / to the end of the INPUT.

Q. I currently have a couple of JavaScripts that are used throughout my
website. One for a date and another for rollovers. Can these two be placed onto
one external js page with a single link to it, or should each be on separate
pages with its own individual link?

A. Yes you can place both scripts in one ".js" file and point to it this
way:
<script src="myscript.js" language="JavaScript"></script>
One thing you will have to be careful of though is that if both scripts use
variable names that are the same one of them will have to be changed or you will
have a conflict. If you are already using them both on the same page then this
should not be a problem.


Q.
I am creating a web site that has several secondary pages, and some of
those secondary pages have even further sub-categories. I would like to have
just one image folder for the entire site. Example: From home page I have a link
to "Authors" page. From that page, links to Twain, Longfellow, etc. The images
folder is on the same level as the Authors page. So on the Authors page the
image links look like this:
/img/pic.jpg
How do I get to the image folder from the Twain page?

A. The easiest way to do this is to use "../" for each level deep the
folder is. For instance: Start in your root folder where the "index" or home
page is. In that folder you also have an "images" folder and the "Twain" folder.
If you are referencing an image from the "index" page it would look mlike this:
img src="images/My_pic.jpg"
That tell the browser to look for the picture in the "images" folder.
Now reference the same picture from the "Twain" folder:
img src="../images/My_pic.jpg"
That tells the browser to look for the picture one level up in the "images"
folder.
Now let’s get a little deeper. In the "Twain" folder you have another folder
named "Clemins". Let’s reference the same picture from a page in that folder:
img src="../../images/My_Pic.jpg"
That tells the browser to look for the picture two levels up in the "images"
folder.

 

 

 

 

Top

News Goodies


EU VAT: a New Tax Headache for E-Commerce
[April 21, 2003] Beginning in July, new European Union regulations will
require U.S.-based companies to charge value-added taxes on
digital sales to consumers across the pond.

Click
here to read the article

 

Motorola Jumps Into Home Networking
[April 21, 2003] Looking to tap into a growing trend, the telecom will sell
its new wireless gateway in Best Buy and Circuit City.

Click
here to read the article

 




Bush Backs RIAA Lawsuit Against Verizon
[April 21, 2003] Justice Department says controversial subpoena power
of the DMCA is constitutional.

Click here to read the article

 

 

 

Adaptec, Rivals Team on Serial SCSI Products
[April 21, 2003] The companies want to ensure serial-attached SCSI interface
compatibility for new storage disk drives.

Click here to read the article

 

 



Upgraded Ask.com Seeks Everyday Searchers
[April 21, 2003] Best known for its Q&A format, the search firm improves
search tools and processing speed to wean users off their Google habit.

Click here to read the article

 



 

It Pays to Host With Verio
[April 21, 2003] The Web hosting service provider extends its reseller
incentive program, continues to offer cash to migrate customers to the Verio
platform.

Click here to read the article

 

 

Sony Pushing Forward on Next Generation Broadband Chip
[April 21, 2003] Questions raised about the timing of Cell, PlayStation 3
and Sony’s ROI.

Click here to read the article

 

 

Overstock, Microsoft Settle Suit over Piracy Allegations
[April 21, 2003] Microsoft charged Overstock with allegedly advertising and
distributing counterfeit and unauthorized Microsoft software.

Click here to read the article

 

 

Office 2003: To Each According to His Need
[April 18, 2003] Microsoft provides greater visibility into its
Office 2003 strategy and its decision to provide capabilities in
various editions according to need.

Click here to read the article

 

 

 

Profits Start to Flow at Digital River
[April 16, 2003] The e-commerce solutions company avoided the rocks
during the IT downturn, and now seems poised for success; analysts
see profitability and maintain a buy rating.

Click here to read the article

 

 

 

 

Top


Goodies Peer Reviews


 

Every week a site selected each week 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

 

 

 

Top

Feedback
Goodies


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/

 


This week most of the feedback concerned the Goodies Peer
Reviews. Most of those writing in expressed concern that the
lack of reviews coming in would cause us to end this young
program before it has a chance to grow. To put your minds at
ease; we don’t plan at this point to terminate this program.
We are, however, very keen to get more participation. This
program requires quite a lot of work to maintain, and we
would love to see more reviews coming in. Several reviews
are being posted this week, so please check them out and see
the kind of thing we are looking for. If any of you thinks
that you don’t know enough for your opinion to be worth
sharing, trust me, you do, and it is!! You know what you
like. If you see it, say so; if you don’t, say what you
would like to see. Reviews are about design, interest and
usability as much as about technical details.
 

 

Top
And Remember This . . .

On this day in…

1918 Red Baron killed in action
Although Snoopy the dog was not around at the time, this was
the day in 1918 on which Baron Manfred von Richthofen was
actually killed (sorry Snoopy, you only did it in Charles’
dreams!) He transferred from the German Army to the Imperial
Air Force in 1915. He initially earned his flying ace
recognition in an Albatross biplane in which he downed 15
enemy planes. In 1917 he started flying a Fokker triplane
which was painted entirely red as a tribute to his old army
regiment. He used this plane for only eight months, but
racked up 80 air victories. On this day in 1918 he pursued a
British plane deep into allied territory, where he was shot
through the chest by an Australian gunner. He was 25 years
old.

Born today were: in 1816 author Charlotte Bronte;
1916
actor Anthony Quinn; 1926 Queen Elizabeth II
(Elizabeth Mary Windsor, Queen of the United Kingdom);
1935
actor Charles Grodin; 1951 actor Tony Danza

 

 




Thanks for reading Goodies to Go!


 



Archive Home Page.


Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles

Featured