Goodies to Go! Newsletter #388

By Vince Barnes

************************************************************
                      Goodies to Go (tm)
               May 9, 2006 -- Newsletter # 388
 
     This newsletter is part of the internet.com network.
                  http://www.internet.com
 
          Please visit http://www.htmlgoodies.com
************************************************************
 
A Note about Email Filtering:
All Goodies To Go newsletters are sent from the domain "internet.com."  Please use this domain name (not the entire "from" address, which varies) when configuring e-mail or spam filter rules, if you use them.
 

Featured this week:
 
*   Goodies Thoughts - The Time It Takes
*   Q & A Goodies
*   Discussion Goodies
*   News Goodies
*   Feedback Goodies
*   Windows Tech Goodie of the Week 
*   And Remember This...

The Time It Takes
 
I was asked recently how long it takes to learn Web Page Design.  That's quite a question!  I can't effectively answer it without making certain assumptions, which might not turn out to be valid.
 
My first assumption relates to the meaning of the word design.  When we talk about designing web pages we frequently actually mean writing web page code.  The difference to me is that design is just that - the look and feel of the page or site.  Certainly web site developers usually are involved in the design of pages, but that is not so much a technical skill to be learned as a talent of gift to be developed.  While there are definitely some tricks that can be picked up to help one make a web page look good, really good design requires an artist's eye.  My first assumption then, is that the question is about the technical side of the matter.
 
Next comes the question of technologies.  The meat and potatoes, so to speak, of Web development are HTML and JavaScript.  If the question is about these to the answer could be "it won't take long to grasp the basics," but that's not a very satisfying answer.  Joe's HTML primers on the HTML Goodies Website are designed to give an intro in seven days, though a lot of people work through them in an afternoon.  Once you've done that, though, there comes a seemingly unending stream of questions beginning "yes, but how do you....."  The same things apply to JavaScript.
 
Of course, there's also the assumption being made that the objective is actually to learn to write code.  This too may be false.  There are several web page generator programs like FrontPage and Dreamweaver that will allow the creation of webpages without having any knowledge of the underlying technologies.  While many purists may see this as the wrong way to go, it does provide the ability to accomplish "Web Page Design" with a much shorter learning curve.
 
All of these thing are just scratching at the surface, however, when the full scope of available technologies is taken into account.  Consider such things as Flash, SQL, ASP.Net, C++, XML, StoryBoard, ColdFusion, SharePoint and so on, all of which have a place in the world of Web Development.  Any one of these can take quite a long time to really master.  There are so many, and new ones appear all the time.
 
While writing these few paragraphs and considering the question a little further, it occurs to me that there actually is a pretty good answer.  "It takes the rest of your life, so the sooner you start, the better off you'll be!"


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

XXXXXXXXXXXXXXXXXXXXXXXXXX
X                        X
X   Please take note:    X
X                        X
XXXXXXXXXXXXXXXXXXXXXXXXXX
 
We have had a number of people indicate that their email client programs are interpreting code examples in this newsletter as actual HTML code instead of text.  To overcome this problem and to enable everyone to read the newsletter, there is a period after the "<" in each tag.  If you cut and paste to try out code examples, please remember to remove the periods.  Wherever we intend you to use "<." in your code, the example will show "<..".  In this way, you will be safely able to use a global edit to change "<." to "<".  Thanks to all of you for your patience with this; if this technique creates an undue problem for you however, please let us know via our feedback address (see Feedback, below).
 

*** This question was submitted to our Mentor Community.
    The answer was provided by one of our Mentor Volunteers
    
Q. Can you please tell me how to add variables?  I know you are suposed 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.


*** This question was submitted to our Mentor Community.
     The answer was provided by the same one of our Mentor Volunteers
 
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, mutiplied, ... 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.

*** This question was submitted to our Mentor Community.
     The answer was provided by the same one of our Mentor Volunteers
 
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 accessable by that function.  You can make it a global variable that is accessable 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>

*** This question was submitted to our Mentor Community.
    The answer was provided by one of our Mentor Volunteers
 
Q. Hello, I have a link question.  On my site I have the link color scheme to be black, which works well on the left bordered side of my page, but not on the right side which has a black background.  Is there anyway to change the color just one or two links without changing the color of all the links?
 
A. Using CSS and assigning a class to each link you can use different colors and other attributes to whichever links you want. For instance if you want one of your links to be black and another to be white you would set up a style sheet like this:
<.style type="text/css">
a.one:link {color: #000000}
a.two:link {color: #FF0000}
<./style>
Place the style between the <.HEAD> tags.  Now apply the class to the actual links in your HTML like this:
<.a class="one" href="default.html">This link will be black.<./a>
<.a class="two" href="default.html">This link will be red.<./a>

*** This question was submitted to our Mentor Community.
    The answer was provided by one of our Mentor Volunteers
    
Q. Is there anyway that I can make multiple frames load at a time without using a form, and using just a regular link?
 
A. There are a couple of different ways you can accomplish this.  The first example uses "inline javascript" to load two frames (in both examples you need to specify the name of the frame that you want the documents to load in):
<.a href="#"
onClick="parent.frame_name1.location='page1.html';parent.frame_name2.location='page2.html'">Click
Me<./a>
The second example uses a function that is passed the documents to load when you click on a link:
<.script type="text/javascript">
  function Doframes(page1,page2)
    {
     parent.frame_name1.location=page1
     parent.frame_name2.location=page2
    }
<./script>
<.a href="#" onClick="Doframes('page1.html','page2.html')">Click Me<./a>


*** This question was submitted to our Mentor Community.
    The answer was provided by one of our Mentor Volunteers
    
Q. I was wondering how to have information filled our on a form sent directly to a e-mail address? If this is possible how can I implement it into my website?
 
A. It does not work very well when you try to email a form directly to an email address.  Usually what happens when the attempt to submit the for is their email client will pop up without the information from the form in the body of the email.  You should use a serverside language such as Perl PHP or Asp to process the form and email it to you.
[Take a look also at:
http://www.htmlgoodies.com/articles/emailforms1.html
http://www.htmlgoodies.com/articles/emailformphp.html  and
http://www.htmlgoodies.com/letters/226.html  -- Ed.]

 

Discussion Goodies
***********************************
 
Have you seen the discussion forums on the HTML Goodies website?  It's a great place to get help from others who, just like you, are developing web pages.  Many different topics appear in the forum, and a new one will appear if you create it!  Here's a sample of recent topics:
 
 
 
 
 

 
 
News Goodies
***********************************
 
The Open Source For IT Management
[May 9, 2006] Effort aims to bring an open source style approach to standards to the broader community of IT management systems vendors and projects.  
Read the article:
http://www.internetnews.com/dev-news/article.php/3604876
 

EMC Pays $153M For Data Protection
[May 9, 2006] EMC will buy startup Kashya to flesh out its CDP and data-replication tools.
Read the article:
http://www.internetnews.com/infra/article.php/3604826
 

Packeteer Picks Up Tacit
[May 9, 2006] Packeteer's $78 million acquisition of Tacit Networks creates a big player in the WAN optimization and wide area file services market.
Read the article:
http://www.internetnews.com/storage/article.php/3604816
 

Dell PowerVault Quadruples Bandwidth
[May 9, 2006] The array also doubles storage capacity and shuttle data 30 percent faster than previous systems.
Read the article:
http://www.internetnews.com/storage/article.php/3604631
 

Security, The Microsoft Way
[May 9, 2006] Microsoft's security honcho spreads the word on Vista's security plans, and integrating with Cisco.
Read the article:
http://www.internetnews.com/infra/article.php/3604666
 

Coming Soon: The AJAX-based OS
[May 9, 2006] Users won't have to store anything locally, since both applications and data files are stored on servers, instead of computers.
Read the article:
http://www.internetnews.com/dev-news/article.php/3604686
 

Can Cisco Jump-Start Techs?
[May 8, 2006] Cisco Systems will try to snap tech stocks out of their doldrums when the networking giant releases quarterly results late Tuesday.
Read the article:
http://www.internetnews.com/bus-news/article.php/3604606
 

App Acceleration Not a Pipe Dream
[May 8, 2006] Networking vendors ramp up acceleration efforts as newcomers come to the fore with new ideas.
Read the article:
http://www.internetnews.com/ent-news/article.php/3604571
 

Doom For Anti-Spyware Software?
[May 8, 2006] UPDATED: Not just yet. A Yankee Group report predicts Vista will harm the anti-spyware market, but that assumes people will buy Vista.
Read the article:
http://www.internetnews.com/security/article.php/3604626
 

The Surge in Mac Attacks
[May 8, 2006] Mac users may have to start learning the language of vulnerability.
Read the article:
http://www.internetnews.com/security/article.php/3604446


 
 
 
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:
 
 
We already receive a lot of email every day.  This address helps 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 for all your feedback!

 
 

Windows Tech Goodie of the Week 
***********************************
 
Visual Studio 2005 Hands-On Tutorial - Part 2
 
This is the second part in a series of hands-on tutorials that will take you through all the steps to build a complete application using Visual Studio 2005 and SQL Server 2005. In this part, David Catherman walks you through building a Windows Forms based interface to the database.
 
 

*** AND ***
 

Examining ASP.NET 2.0's Membership, Roles, and Profile - Part 4
 
Improve the login experience by showing more informative messages for users who log on with invalid credentials; also, see how to keep a log of invalid login attempts.
 
 

*** AND ***
 

'Teach Yourself Ajax in 10 Minutes' Sample Chapter
 
One of my contacts from Sams recently sent me an email telling me about their latest offering: 'Teach Yourself Ajax in 10 Minutes'. The sample chapter, Chapter 11: Our First AJAX Application, walks you through building your first simple Ajax application.
 

 
And Remember This ...
***********************************
 
On this day in...
 
1092 Lincoln Cathedral (England) was consecrated; 1671 Colonel Thomas Blood attempted to steal the British Crown Jewels; 1899 the lawn mower was patented; 1901 Australia opened its first Parliament, in Melbourne; 1927 the Australian Parliament first convened in its new capitol, Canberra; 1932 Picadilly Circus in London was first lit by electricity; 1949 Prince Rainier III became leader of Monaco; 1962 The Beatles signed their first contract, with EMI Parlophone; 1971 Friends of the Earth returned 1,500 non-returnable bottles to Schweppes; 1977 Patty Hearst was released from jail; 1980 35 motorists died when a Liberian freighter rammed a bridge in Tampa Bay; 1995 Kinshasa, Zaire was quarantined following an outbreak of the Ebola virus;

Born today were: in 1800 abolishionist who led the attack on Harpers Ferry, John Brown; 1860 Scottish novelist Sir James Matthew Barrie (Peter Pan); 1873 English archeologist/Egyptologist Howard Carter (found Tutankhamen's tomb); English dog training expert Barbara Woodhouse; 1913 Admiral John Hayes; 1930 English actress Joan Sims; 1936 actor Albert Finney; 1936 English actress Glenda Jackson; 1946 actress Candace Bergen; 1949 musician Billy Joel; 1962 actor John Corbet;


*************************************************************
EarthWeb's family of online services for IT insiders
*************************************************************
IT MANAGEMENT http://www.earthweb.com/dlink.index-jhtml.72.949.-.0.jhtml


Make a Comment

Loading Comments...

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
  •  
  •  
  •  
Thanks for your registration, follow us on our social networks to keep up-to-date