There are different situations when you may want to use an external javascript file. One idea may be to reference a single script from different web pages. Another idea may to be to conform closer to the W3C standards. Perhaps the reason is “just because”.
Having an external JavaScript page is similar to having an external [...]
Sometimes images can be a bit large in memory size. Having a rollover effect work efficiently means it should work properly from the start of the page being loaded. Without a preload, there may be a short delay in the rollover effect at first since the browser will only download images as they become “active” [...]
Rollovers, Mouseovers, Image Swaps… It goes by many variations of names, but means the same thing. Making one image change into a different one when a mouse pointer goes over a specified area.
The first thing you will need are 2 images. One for normal view, a second for the change.
The first image will be placed [...]
Creating a new window to pop open is easily done using regular HTML and the TARGET property. What about configuring those windows? Size, position, toolbars, etc… ?? That is where JavaScript steps in.
Using a simple function and a form button, here is a script to open my “page 1″ into a new “regular” window. The [...]
One of the most used instances of JavaScript is location. Location represents the URL or web page address. Location can be used to determine the current URL and also to change the URL to a different page or site.
The location of this page is : // http://blog.keyw0rk.net/tutorials/JavaScript/location/
The location of this page is :
<script type=”text/javascript”>
<!–
document.write(location.href);
// [...]
Timeouts are like a timer. It can allow you to execute a section of code after a specified amount of time has passed. If you have viewed this page for 30 seconds, you have probably noticed a working example of this. Here is the code used :
//
<script type=”text/javascript”>
<!–
setTimeout(“alert(‘Thirty seconds has passed.’);“,30000);
// –>
</script>
Notice that the [...]
A PROMPT is used to actually gather a bit of information when a simple TRUE/FALSE is not enough. This will take some information from the visitor and you can use it in other applications.
In the PROMPT example, you entered : // Samet
Did you notice I was able to use the input answer [...]
A CONFIRM box is used when you are trying to get a YES / NO answer from the visitor. The OK button acts as the YES response the CANCEL button acts as the NO response.
To get the CONFIRM actions to perform, we have to use a VARIABLE situation to control it. That means, we have [...]
You have probably come across some sites that have an ALERT information box pop-up. This happens to be one of the most basic functions that JavaScript can perform.
Alert boxes are used to display some text information and have the visitor click on the OK button to continue on. This script is usually placed in the [...]
If JavaScript is the only type of “script” language you are using on the page, you can specify a BASE setting and not have to include the TYPE for each SCRIPT. This is commonly done when there are many areas of script within the page code.
The BASE setting is created using a META tag. These [...]