You will see lots of different variants of how the script tag is written across various web sites. Here's what each of the different variants is for.
- Function Expressions and Function Statements
- "Magic" Type Conversions
Quick ways to convert to a number and to extract the integer and fraction portions from a number.
- Test Your Code
Something you should always do before you ask for help. Here we look at how to test your code.
- Finding an Error
There are ways to obtain more information about what your code is doing to help work out where an error is occurring.
- Why <noscript> is Useless
- Replacing the <noscript> tag
A more in-depth article on why the tag is now useless and how you can provide your own far more powerful replacement.
The best place in the web page to add your script and why it is the best.
A closer look at the reasons for deciding where to place your script tag.
Another look at where to put your scripts considering the different points where the script may need to run.
Beginners often try to write the entire code before they start to test. That's the wrong approach.
- Speed Test
Even the way beginners refer to events can show that they are using an antiquated approach.
- Event Delegation
A single event listener can handle multiple elements all at once.
- Scope and Closures
Most scripts can still work even if the images haven't finished loading just as long as the script knows how big the image actually is.
- Replace Noscript with CSS
- Which DOM to Use
You can make your script less obtrusive by applying one or more of these steps.
- Polluted Global Namespace
Write your code to be ready for future browsers.
This command served a purpose in early browsers but now prevents you from using modern coding techniques. Is it time to consider turning off this antiquated command?
- Information about Visitors to your Site
- Feature Sensing vs Browser Sensing
Sensing for feature support works better than sensing which browser is being used.
- Browser Detection
Just how accurately can we detect which browser is being used via browser sensing?
- Loop Variables and Events
Attaching event handlers inside a loop in a way that allows them to access the loop counter when they run.
- Event Propagation
An explanation of the order in which events attached to different tags will run when they are all triggered by the one event.
- Common Beginner Mistakes
- Don't use parseInt
- Ways to Define A Function
- Analysing Code
- Parameters and Arguments
The meanings of these terms is not the same now as it used to be.
- How Many Returns
A look at why you should normally only need one return statement per function and the types of situation where you might consider using two instead.
- setTimeout and setInterval Parameters
A common mistake newbies make when using these functions and how to fix it.
- Unnecessary Loops
If you never learnt programming then you may not be working out the best way to achieve the desired result before you start writing your code.
- Function Scope and Binding Event Handlers
- String and Number Data Types
There is more than one way to convert between data types.
- Arrays, Arguments and Nodes
While function argument lists and node lists look like they are arrays, they are not.
- Sparse Arrays
- The perils of for..in
- Closures and Scope
- Keydown and Keypress
Two similar events that serve completely different purposes.
- Generating HTML
Reasons people have for doing so and why they are mistaken.
- Script for Printing
If all your scripts are written properly so as to be as unobtrusive as possible then you shouldn't get clashes between scripts to prevent them running on the same page.
There is a myth that combining unrelated scripts into one file will make them load faster - the opposite is actually true.
- Base Conversion
- Passing Information Between Pages
Three ways to pass information between web pages.
- A Cookie Toolbox
A collection of functions that you can use to handle cookies.
- User Agents
How to identify which browser it really is from the user agent field.
- Choosing from Alternative Ways to Code
What are favelets and bookmarklets?
- Creating a Static Link
A DOM tutorial on creating a static link.
- Cookie Limits
Limitations on cookie size and number.
- sIFR - Why Bother
- Which Browser is That?
It is rarely necessary to identify which browser your visitor is using and only a small number of browsers allow themselves to be correctly identified 100% of the time.
- Adobe AIR 1.5 Cookbook
- Opera and the Open Statement - A Solution
please ask Felgall.
We now have Package Deals to create and maintain your website for you.
(includes special prices for community groups and hobby clubs)