Comparing strings in JavaScript


<script type="text/javascript">
var username = "test";
if(username == "test")
    document.write("Welcome");
else
    document.write("Access Denied!");
document.write("<br /><br />Try again?<br /><br />");


</script>

While '14' == 14 is true (because by converting either the left side
value to a number or converting the right side value to a text string
will result in both being the same) '123' === 123 is false since one
value is a text string and the other is a number.

The === operator does the same thing with one minor difference. This
operator does not convert data from one type to another.

JavaScript String indexOf

var p = navigator.platform;
system.win = p.indexOf(“Win”) == 0;
system.mac = p.indexOf(“Mac”) == 0;
system.x11 = (p.indexOf(“X11”) == 0) || (p.indexOf(“Linux”) == 0);


This code uses the indexOf() method to look at the beginning of the platform string. To detect
Windows, the platform-detection code simply looks for the string “Win” at the beginning of the
platform string (covers both “Win32” and “Win64”). Testing for a Mac platform is done in the same
way to accommodate both “MacPPC” and “MacIntel”. The test for Unix looks for both “X11” and
“Linux” at the beginning of the platform string to future-proof this code against other variants.

<script type="text/javascript">
var mURL = "http://www.google.com/";
var mPosition = mURL.indexOf("www");

document.write("The position of www  =  " + mPosition); 
</script>

Why Use Sitemaps?

It is important to use Sitemaps because they help your visitors quickly get to the information
they need, and they help web spiders find your site’s links.
There is no universal Sitemap rule that you can apply to every site. Understanding
different Sitemap options should help you identify the right type for each situation. The
following subsections discuss some of the reasons for using Sitemaps.

Crawl augmentation
Although web spiders are continuously improving, they are far from perfect. Search
engines have no problems admitting this.

Poor linking site structure
Not all sites are created equal. Sites with poor linking structures tend to index poorly.
Orphan pages, deep links, and search engine traps are culprits of poor site indexing.
The use of Sitemaps can alleviate these situations, at least temporarily, to give you
enough time to fix the root of the problem.

Crawling frequency
One of the biggest benefits of using Sitemaps is in timely crawls or recrawls of your site
(or just specific pages). XML Sitemap documents let you tell crawlers how often they
should read each page.
Sites using Sitemaps tend to be crawled faster on Yahoo! and Google. It takes Google
and Yahoo! minutes to respond to Sitemap submissions or resubmissions. This can be
very helpful for news sites, e-commerce sites, blogs, and any other sites that are constantly
updating or adding new content.

AdSense Earnings

The Google ads you are able to display on your content pages can be either cost-per-click
(CPC) or cost-per-1000-impressions (CPM) ads, while AdSense for search results pages
show exclusively CPC ads. This means that advertisers pay either when users click on
ads, or when the advertiser’s ad is shown on your site. You’ll receive a portion of the
amount paid for either activity on your website. Although we don’t disclose the exact
revenue share, our goal is to enable publishers to make as much or more than they could
with other advertising networks.

Typically, Google sends checks about one month behind if your earnings pass Google’s
payment threshold ($10 in the United States). You are responsible for paying any taxes
as required in your country. Let’s look at example earnings you can make with AdSense.
Suppose you have a site that shows 1,000 AdSense impressions per day. Assuming that
your CTR is at 1% and that the average click worth is $0.10, we get the following:
Daily AdSense Earnings =
1000 (impressions) × 0.01 (CTR) × 0.10 (click worth)
= $1

So, if you have a busy site, you can do the math and see what you can earn. It sounds
pretty simple, but to make it work you need to put in the time to create good content.
A lot depends on your visitor levels as well as how you integrate AdSense within your
site(s).

Competitor Research and Analysis

Competitor research and analysis may seem like a copycat activity, but it is not (at least
not entirely). It is about understanding what your competitors are doing. It is about
examining their keyword and linking strategies while realizing their current strengths
and weaknesses. The bottom line is that you are trying to understand what is making
your competitors rank.
This activity may comprise elements of emulation, but what you are really trying to do
is be better than your competition. Being better (in a general sense) means providing a
site with more value and better perception. In an SEO sense, it means understanding
all the things that make your competitors rank.
When learning about your competition, it is good to examine their past and present
activities, as well as implement ways to track their future activities. Although many
tools are available for you to use to learn about your competition, for most of your work
you can get by with the free tools that are available. This chapter emphasizes the free
tools and research that you can use in your work.

Finding Your Competition
Before you can analyze your competitors, you need to know who your competitors are.
How do you find your biggest competitors? One way to do this is to find sites that rank
for your targeted keywords. The sites that sell or provide products and services similar
to yours are your competitors.
There is a catch if you’re relying only on keywords, though. How do you know whether
you are targeting the right keywords? What if you miss important keywords? You may
be starting off in the wrong direction. This makes it all the more important to do your
keyword research properly. No tool or activity will ever be perfect. You have to start
somewhere.

Link Building

There are countless opportunities for link building. Everything starts on your site. Your
site should make it easy and intuitive for anyone wanting to link to it. To increase your
chances of people linking to your site, you need to provide something of value.
Basic Elements
The following subsections talk about the rudimentary elements that all sites need to
consider.
Take out the guesswork
Take out the guesswork for your web visitors by providing the HTML code fragment(s)
for people to link to your site. Create “Link to Us” and “Tell a Friend” links. Most CMS
software includes prebuilt forms for handling these simple concepts.

Run a daily, weekly, or monthly email newsletter
Running your own newsletter provides several benefits. First, you get to remind your
existing visitors of your new offerings, whether it is content, products, or services. Plus,
the recipients of your newsletter are likely to forward it to people they know if they find
your newsletter interesting.

Provide registered services
Many sites offer free and members-only content. This model offers several benefits. If
your free content is already great, many of your visitors will also be interested in your
members-only content. The idea is that the content that is provided to members only
is of even greater quality than the public content. Many sites charge for members-only
content. Providing registered services helps you build up the email lists that you can