HTML Goodies: Script Tip: Week 11
WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
Hey, Tip Types...
Let's tear this one apart. Today we're going to look at a rather small but quite important command, the equal sign.
Let's take a quick look at the script again:
<!--Hide the Script
//This Script written by Joe Burns, Ph.D.
if (navigator.appname == "Netscape")
// End hiding the Script-->
I want you to look at two uses of the equal sign within the script:
Without getting into a lot of programming mumbo jumbo, here's the basic difference (and this always did seem backward to me).
- A double equal sign means "is equal to."
Notice the line above involving the double equal sign? It is saying if the navigator application name is equal to Netscape.
- A single equal sign means "is."
I'm sure there's a better way of putting it, but that's how I keep it all straight. Notice the line above that uses the single equal sign? It is saying the parent location is nspage.html.
You'll also see a single equal sign being used to denote variables and the like. Just keep it all straight by remembering that only the double equal sign means "is equal to" and the single equal sign can be roughly translated into "is."
That should help you keep it all straight, too.
Next Week: The IF/ELSE Condition
HTML Goodies 30-Step Primer Series
and take the knowledge home with you in
on your Web pages here!