Tuesday, March 19, 2024

Goodies to Go! Newsletter #314

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


Featured this week:

* Goodies Thoughts – The Ruler of the
Web

* Q & A Goodies
* News Goodies
* 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 – The Ruler of the Web


My thanks go out to Emilio Sanchez for his question concerning
the priorities we need to consider when we are designing web sites. It’s a great
question, and one which all too often is neglected, and though I’ve talked of it
before, its weight deserves reconsideration.

When we learn HTML, JavaScript and PHP or PERL, we learn all sorts of wonderful
tricks for doing this and that on a web page. The more we learn, the more
sophisticated the techniques and tricks are that we can deploy. But is that
really a good idea?

There is no doubt that I absolutely love the World Wide Web — it is my primary
information resource, the means for me to find my way from town to town, the way
I shop for my electronics, cars and cheese, etc.; in short, it augments the
education my teachers kindly gave me and enables me to be considerably more
effective in the modern world.

It does so because of all the information it contains.

There, Emilio, is the answer to your question.

When we study the techniques and languages used in the creation of web pages, we
do so as a means to an end. That end is the provision of information and
services to the world of Web visitors. It is most definitely not based in the
techniques themselves. In fact, I’d say that the tools used to provide the
content on the web are completely incidental. Except that they are needed to
provide that content!

There are countless examples on the web of sites that use the simplest of
techniques but deliver the most powerful of messages. I did a Google search for
"hungry people", and while some of the resulting sites were fairly sophisticated
in their technique, many were the simplest, most basic HTML. Their message was
abundantly clear and powerful, however.

There is no doubt, Emilio; the top priority to consider when creating your web
site is content. If you have a message, say it clearly and concisely. If you are
selling something, describe it completely but as briefly as possible, and make
it as easy to buy as you can. Whatever the purpose of your site, make it as easy
to navigate, as easy as possible for somebody to find what they need. The HTML
code you use, the other technologies you deploy, are all there to help you
deliver your message. The ultimate reward goes to those whose message is best,
rather than to those who use the best delivery mechanism.

 

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

http://www.htmlgoodies.com/mentors
.

Q. Can you please tell me how to add variables? I know you are supposed
to add two variables with a + sign but it doesn’t work most of the time. It adds
the number to the end of the variable instead of adding them together. For
example, if I wrote this:
var a = 7;

var b = 2;
var c = a + b;
document.write( c );
I would get 72. Can you please tell me how to correct this?

A. In JavaScript, variables can be either numbers or strings. Strings are
enclosed in quotation marks. If a number is enclosed in quotation marks, it is
treated as a string. In JavaScript, the + sign is used for concatenation, or the
combining of strings, as well as the addition of numbers.
Using your example:
var a = "7";

var b = "2";
var c = a + b;
document.write( c );
will return "72" as a string (without the quotation marks of course), but:
var a = 7;
var b = 2;

var c = a + b;
document.write( c );
will return 9 as a number. So, if your results are concatenations instead of
numbers, check your code and remove any quotation marks from around digits that
should be treated as numbers.

Q. You just explained to me that anything inside of quotes in a variable
will be treated as a string. Here is the problem. When I have a user enter a
number to be used for math it is treated as a string. Then when I do math with
it the number is added to the end which makes the answer incorrect. Can you
please give me a method for the user to be able to enter a number and have it
treated like a value instead of a string? Or if not, is there a way to convert
strings into values?

A. JavaScript interprets a default value given to a text area as a
string. The workaround is to use the eval() function when processing that value
as a number. If your user inputs a number to a text area in a form, and that
number is to be added, subtracted, multiplied, … etc, process the number
within the eval() function. From your previous example, suppose the user inputs
to the variables a and b via text boxes in a form, you can then add a to b to
return c with this:

c = eval(a) + eval(b)
This way, the values in both a and b will be treated as numbers instead of
strings.

Q. I have one more problem with JavaScript programs. A lot of times I
create variables and then when I try to use them I get an error saying that they
are undefined. Why is this? Here is an example of when this happens:
<SCRIPT LANGUAGE="JavaScript">
function part1()

{
var a = 1;
}
function part2()
{
if (a == 1)
{
document.form.textbox.value = "The variable worked, finally!!!";

}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="form">
<INPUT TYPE="RADIO" NAME="why_doesnt" VALUE="the_variable_work" onClick="part1();">

<INPUT TYPE="BUTTON" VALUE="Variable work?" onClick="part2();">
<INPUT TYPE="TEXT" NAME="textbox" VALUE="If the variable worked, a message would
appear here.">

</FORM>
If I write this in a document and click the button, an error message comes up
saying that it is undefined. I’ve tried creating the variable directly from the
event handler, renaming the variable, using checkboxes instead of radio buttons,
and nothing works. I have tried putting an alert box in the function and it
comes up so I know the function is executing. It just won’t remember the
variable.

A. You are declaring a as a variable from within a function. This makes
it a local variable that is only accessible by that function. You can make it a
global variable that is accessible by any function by declaring it from outside
any functions, but still between the script tags. Usually global variables are
declared before the first function for the sake of clarity, but they can be
declared from anywhere between the script tags, just not inside a function.
Here’s your script with a as a global variable:
<SCRIPT LANGUAGE="JavaScript">
var a = 0; // declares a as a global variable and initializes it to 0
function part1()
{

a = 1; // the function sets the global variable a to equal 1
}
function part2()
{
if (a == 1)
{
document.form.textbox.value = "The variable worked, finally!!!";
}

}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="form">
<INPUT TYPE="RADIO" NAME="why_doesnt" VALUE="the_variable_work" onClick="part1();">

<INPUT TYPE="BUTTON" VALUE="Variable work?" onClick="part2();">
<INPUT TYPE="TEXT" NAME="textbox" VALUE="If the variable worked, a message would
appear here.">

</FORM>

Q. I had to make some last minute changes to my home page and transferred
it (FTP) None of the changes I made show up on the page. I removed the home page
from the domain and then sent the new one, and still the same problem. I just
can’t seem to figure it out.

A. Try emptying your browser cache and history and then reload the page.
Double check that you are uploading the page to the correct folder AND the
correct website if you have more than one website that you work on. I have made
the mistake of uploading to the wrong site. Let me know how you make out. 9
times out of 10 it is a caching problem.
 

 

 

 

 

Top

News Goodies

Supreme Court to Hear Broadband Access Case
[December 6, 2004] Justices will review the 9th Circuit
decision that overturned the FCC.

Click
here to read the article

 

CA’s Unicenter Focuses on Mainframes
[December 6, 2004] The company has started efforts to revamp its mainframe
management software.

Click
here to read the article

 

 

 


Linux Servers Selling Strong

[December 6, 2004] Thanks to fervent adoption, Linux revenue is
projected to reach $9.1 billion by 2008.

Click here to read the article

 

 

 

Sun Submits New Open License
[December 6, 2004] The company wants to spark discussion but
won’t tip its hand at any product plans for its modified
Mozilla license.

Click here to read the article
 

 

 

Microsoft Pads 64-bit Support in SQL Server
[December 6, 2004] The software giant trots out a second preview, adding
64-bit support for Analysis and Integration services.

Click here to read the article

 

 

 

IBM Inks U.K. Networking Deal
[December 6, 2004] Big Blue wins a 7-year, $1B deal with Lloyds that
includes a sizeable VoIP deployment.

Click here to read the article

 

 



Unisys Helps Oracle, Microsoft Team Up

[December 6, 2004] The Chicago Parks District and the Nevada Department
of Public Safety are part of a new program uniting the three companies.

Click here to read the article

 

 

 

Phishing Grows with Holiday Shopping Spike

[December 6, 2004] Attacks jumped 80 percent in November and now target the
workplace.

Click here to read the article


 

 

Bush Signs ‘Net Access Tax Moratorium
[December 3, 2004] New ban on connection taxes extends exemptions to
broadband hookups.

Click here to read the article

 

 

 


EPassports Could Have Blocking Mechanism

[December 3, 2004] State Department promises to prevent
‘skimming’ of passport data.

Click here to read the article

 

 

 

 

Top


Goodies Peer Reviews


 

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

http://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
http://www.htmlgoodies.com/mentors/

Thanks again for all your feedback!
 

 

Top


 


Windows Tech Goodie of the Week:
 

Update Multiple Records with the DataGrid, DataList and
Repeater

While the DataGrid and DataList controls have built-in
support for updating data, you can only update a single
record at a time and if you’re using the Repeater, there’s
no built-in update support at all. This article will show
you a very simple way to update multiple records using the
DataGrid, DataList and Repeater.


http://www.asp101.com/articles/lee/multiupdate/default.asp

*** AND ***

A Brief Introduction to NAnt

NAnt is a free .NET build tool based on Ant (a build tool
for Java). NAnt, like Ant, is similar to Make in that it is
used to generate output from your source files. But where
Ant is Java-centric, NAnt is .NET-centric.
NAnt has built-in support for compiling C#, VB.NET, and J#
files and can use Visual Studio .NET solution files to do
builds. NANt also has built-in support for NUnit and NDoc
(.NET version of JUnit and JDoc, respectively).


http://aspnet.4guysfromrolla.com/articles/120104-1.aspx

 

 


 

Top


 

 

 

 
And Remember This . . .

On this day in…
 

1917 Mont Blanc Exploded

In the harbor at Halifax, Nova Scotia, in Canada, at 8:45 in the
morning, the French munitions ship Mont Blanc collided with the
Norwegian ship, Imo. At the time, the Mont Blanc was loaded with
high explosive munitions, intended for the war effort in Europe. The
collision ignited picric acid in the cargo. The crew attempted to
alert the harbor personnel to the danger of the cargo on board, but
their warnings fell on deaf ears. The fire department arrived,
parking their equipment next to the ship as it brushed the harbor
wall, setting it ablaze. Spectators gathered to watch the burning
ship. The ship exploded with a massive, blinding white burst,
instantly killing 1,800 and injuring 9.000 more. 200 were
permanently blinded by the flash. The north end of the city of
Halifax, including 1,600 homes was completely destroyed. the
explosion shattered windows up to fifty miles away, and could be
heard for twice that distance. It is deemed the most devastating
explosion of the pre-nuclear age.

Today was also the day that in: 1240 Bhatu Khan led the
Mongols in the destruction of Kiev; 1534 Quito Ecuador was
founded by the Spanish; 1768 the first edition of
Encyclopedia Britannica was published; 1833 HMS Beagle set
sail from Rio de la Plata with Charles Darwin aboard; 1865
the 13th Amendment to the US Constitution was ratified, thereby
abolishing slavery (at least, making it illegal); 1877 the
first edition of the Washington Post was published; 1877
Thomas Edison made his first sound recording; 1912 China
voted in favor of Universal Human Rights; 1921 The
Anglo-Irish treaty was signed, giving Ireland dominion status and
partitioning off Northern Ireland; 1941 the New York City
Council agreed to build the Idlewild Airport, later named John F.
Kennedy Airport in Queens, New York; 1956 Nelson Mandela and
156 others were arrested for political activities in South Africa;
1982 IRA bobm attack killed 17 in a Northern Ireland disco;
1988 Nelson Mandela was transferred to the Victor Vestor
prison in Capetown; 1995 Michael Jackson collapsed while
rehearsing for an HBO special

Born today were: in 1421 King Henry VI of England; 1792
King Willem II of the Netherlands; 1822 US pencil maker
John Eberhard; 1870 actor William S. Hart; 1918
endoscope inventor Harold Hopkins; 1920 musician Dave Brubeck;
1924 actor Wally Cox; 1929 actor King Moody; 1932
boxing promoter Don King; 1943 English musician Mike Smith
(Dave Clark 5); 1952 actor Terence Knox; 1953 actress
Gina Hecht; 1954 actor Miles Chapin; 1956 musician
Peter Buck; 1966 (or 76?) actress Lindsay Price;

 




Thanks for reading Goodies to Go!

 

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles

Featured