Nov 8, 2009
Pages: 1, 2

Image Rollovers In Javascript - A Write-Once, Use-Anywhere Approach

free web hosting

Read Latest Entries..: (Post #11) by MCSESubnet on Mar 21 2007, 07:42 PM.
If you find yourself unable to use javascript, or desire an alternative.I would suggest using CSS. here is the basic idea of what you need in your CSS entry.CODElink_text        {/*make the link text transparent*/        visibility: hidden;     }.link_href    {/*Display this image in the link area*/        background: url(ima...
read more.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion > MODERATED AREA > Tutorials

Image Rollovers In Javascript - A Write-Once, Use-Anywhere Approach

SystemWisdom
Tutorial: Image Rollovers w/ Javascript, by Rob J. Secord, B.Sc. (SystemWisdom)


See a working Sample of this Script!

Download a ZIP containing all working files in this tutorial!

Note: If you are not interested in reading this entire tutorial and/or have a basic understanding of the underlying concepts, you may safely skip to the Implementation section to get the code!


Description:
A Dynamic Image Rollover Script tested to work in 4 major internet browsers: MSIE, FireFox, Netscape and Opera.
Using only Javascript combined with regular HTML Images (<img src="...">) we will create a Dynamic Write-Once, Use-Anywhere Image Rollover script with support for multiple directories.

Since Image Rollovers can be achieved in many different ways, there are other methods that you may find to be more suitable for your situation. Some very good examples (though quite different from this one) can be found right here on Trap17 Forums, such as this one by rvovk which uses CSS.

The beauty of my proposed method is in the Write-Once, Use-Anywhere approach, so as to reduce the amount of extra code required with each extra image-rollover, when used multiple times.



Intended Audience:
Beginner to Intermediate Web Developers.

Assumed knowledge:
-- HTML Images
-- Some Javascript


Theory:
We will start by creating a single directory to hold all of our images on our web server. We will call this the 'images' folder for the rest of this tutorial. Within this directory you may place all of your images and/or sub-folders with more images.

Next we create a JS File to hold our Javascript code which makes the Rollover effect. We only need the one script for every possible image rollover in our site.

Lastly, we combine them both into an HTML file for use!


To demonstrate the file structure, imagine the following sample:

-- index.html
-- rollover.js
-- images
    [/tab]+--- sub_dir1
[tab]|    [/tab]|-------- Image1.gif
[tab]|    [/tab]|-------- Image1_.gif
[tab]|
    [/tab]+--- sub_dir2
[tab]|    [/tab]|-------- Image2.gif
[tab]|    [/tab]|-------- Image2_.gif
[tab]|
    [/tab]|--- Image3.gif
[tab]|--- Image3_.gif
    [/tab]|--- Image4.gif
[tab]|--- Image4_.gif


The Bold entries are Folders, and the Italic entries are Files.
Now, imagine those are the real file and folder names, as I will use some of those names in examples for the rest of this tutorial.


Implementation:

Part 1

Start off by creating an 'images' folder for your web-site, and place within it a few Images and maybe even a sub-folder with more images. The important part of this step is the Name of the Images. Since an Image-Rollover Effect involves switching from 1 image to another, we will need 2 images for each Rollover Effect.

Looking at the Sample File Structure above, you will notice that each image has a second image of the same name, but with a trailing underscore '_'. The image pairs with the same name go together to perform the Image Rollover, and could be named anything you want.
The only 2 rules in naming your Rollover Images are:
  • Both images contain the same name.
  • The second image has a trailing underscore.

The first image (without the underscore) will be the default display image and when the user rolls the mouse over the image, it will change to the second image (with the underscore). This will be performed by the Javascipt in the next part of this tutorial.


Part 2

Next we need to create the Javascript file which will be used to perform the Image Rollover.
I will begin by showing the completed source code and then explain it afterward:

File = rollover.js
CODE


// Gets an Images Filename without the path and extension.
function FileName( szFile, iTrim )
{   return szFile.substring(szFile.lastIndexOf("/") + 1, szFile.length - iTrim);
}

// Image Mouse Over/Out Effects
function MEffect( oEvent, szDir )
{  var oTarget;
  if( oEvent.srcElement ) oTarget = oEvent.srcElement;
  else if( oEvent.target ) oTarget = oEvent.target;

  switch( oEvent.type )
  {
     case "mouseover":
        oTarget.src = szDir + "/" + FileName(oTarget.src, 4) + "_.gif";
     break;

     case "mouseout":
        oTarget.src = szDir + "/" + FileName(oTarget.src, 5) + ".gif";
     break;
  }
}


First of all, you'll notice that it is small! Consisting of only 2 simple functions which could be used for all of your Image Rollovers for your entire site!

This first function simply returns the name of the file without the path and extension (and also the underscore if it is there, which is determined by the size of the iTrim variable. More on that later.

The second function is the bulk of the Image Rollover code.
It expects 2 parameters to be passed to it, and they are:
  • oEvent - This is the Event that is caught by Javascript, and contains details about the type and target of the event.
  • szDir - This is a string that contains a relative path to the Images used for the current Rollover.

First, we need to find the Target of the event (in this case it would be an HTML IMG Object which the user has moved their mouse over/out). Some browsers recognize the built-in 'srcElement' attribute of the HTML IMG Object, where others recognize the built-in 'target' attibute. We determine which to use by testing the attribute in a regular IF expression, as seen in the code above.

Now that we have our Target IMG Object, we can then find the Type of the event (in our case we will want to watch for the "mouseover" and "mouseout" events), and with a switch statement we can determine which event has occured.
Example:
CODE

  // [...]

  switch( oEvent.type )
  {
     case "mouseover":
        // [...]
     break;

     case "mouseout":
        // [...]
     break;
  }


Now, to actually change the Image for the Rollover effect, we will again use our Target IMG Object to find the current 'src' attribute (<img src="which is this part">) for the image, and change it to point to the new Rolled-Over/Out image.
Example:
CODE

oTarget.src = szDir + "/" + FileName(oTarget.src, 4) + "_.gif";


We pass the 'oTarget.src' variable to the FileName() function to extract the Filename without the path and extension, and rebuild the string to include the relative path to the new image, and the extension containing the underscore (or without the underscore for the rollout effect).

Now, since we know which event we are coding within (either "mouseover" or "mouseout"), we will know how much of the extension to trim. If the event is "mouseover" then we know that the current image filename does NOT include an underscore, so we only trim the last 4 characters of the extension (namely ".gif"). This is the 4 you see in the FileName() function just above.
However, if we are coding in the "mouseout" function, then we know that the current image filename DOES contain the underscore, and we must then pass 5 to the FileName() function to tell it to trim the last 5 characters from the extension (namely "_.gif").

Once we have the filename all alone, we can rebuild it with the new relative path (the 'szDir' parameter) along with the underscore and extension (or just the extension). Once the new Image Filename string is built, we simple assign it to the 'oTarget.src' variable of the current IMG Object, and voila! The image has changed!



Part 3

Finally, we create our webpage where we will use the Image Rollover effects on our images, and again I will show the completed code and explain it afterwards:


File = index.html
CODE

<html>
<head>
<script language="javascript" src="rollover.js"></script>
</head>

<body>

<img src="images/sub_dir1/Image1.gif" onmouseover="MEffect(event, 'images/sub_dir1')" onmouseout="MEffect(event, 'images/sub_dir1')" />


<img src="images/sub_dir2/Image2.gif" onmouseover="MEffect(event, 'images/sub_dir2')" onmouseout="MEffect(event, 'images/sub_dir2')" />


<img src="images/Image3.gif" onmouseover="MEffect(event, 'images')" onmouseout="MEffect(event, 'images')" />


<img src="images/Image4.gif" onmouseover="MEffect(event, 'images')" onmouseout="MEffect(event, 'images')" />

</body>
</html>


First we include our 'rollover.js' file to have access to the Image Rollover functions.

Next we create our HTML IMG tag pointing to the default image, as in:
CODE

<img src="images/sub_dir1/Image1.gif" />



Finally, we add 2 event handlers to the image tag, one for the "mouseover" event, and one for the "mouseout" event. The event handlers will be the same function, the 'MEffect()' function from our 'rollover.js' file. The first event looks like:
CODE

onmouseover="MEffect(event, 'images/sub_dir1')"


'onmouseover' is a built-in attribute which calls a user-defined function when the user passes the mouse over the object. We tell it to call out 'MEffect()' function, passing it 2 parameters. The first one is another built-in keyword that specifies the Event Details of the current event. We used this to find the Event Type and Target in the function. Lastly, we pass the Image path to the new image.

Looking at the final HTML IMG tag we have:
CODE

<img src="images/sub_dir1/Image1.gif" onmouseover="MEffect(event, 'images/sub_dir1')" onmouseout="MEffect(event, 'images/sub_dir1')" />



And from the complete example above you will notice that there are many images all using the same image-rollover function!



Putting it all together, we have:


File = index.html
CODE

<html>
<head>
<script language="javascript" src="rollover.js"></script>
</head>

<body>

<img src="images/sub_dir1/Image1.gif" onmouseover="MEffect(event, 'images/sub_dir1')" onmouseout="MEffect(event, 'images/sub_dir1')" />


<img src="images/sub_dir2/Image2.gif" onmouseover="MEffect(event, 'images/sub_dir2')" onmouseout="MEffect(event, 'images/sub_dir2')" />


<img src="images/Image3.gif" onmouseover="MEffect(event, 'images')" onmouseout="MEffect(event, 'images')" />


<img src="images/Image4.gif" onmouseover="MEffect(event, 'images')" onmouseout="MEffect(event, 'images')" />

</body>
</html>



File = rollover.js (Some stuff added)
CODE


// Gets an Images Filename without the path and extension.
function FileName( szFile, iTrim )
{   return szFile.substring(szFile.lastIndexOf("/") + 1, szFile.length - iTrim);
}

// Image Mouse Over/Out Effects
function MEffect( oEvent, szDir )
{  var oTarget;
  if( oEvent.srcElement ) oTarget = oEvent.srcElement;
  else if( oEvent.target ) oTarget = oEvent.target;

  switch( oEvent.type )
  {
     case "mouseover":
        oTarget.src = szDir + "/" + FileName(oTarget.src, 4) + "_.gif";
        oTarget.style.cursor = 'pointer';
     break;

     case "mouseout":
        oTarget.src = szDir + "/" + FileName(oTarget.src, 5) + ".gif";
        oTarget.style.cursor = 'default';
     break;
  }
  window.status = '';
}


TIP: Extending the rollover is easy, try adding a 3rd parameter to the MEffect() function that contains a string for the window.status attribute!


Conclusion:

Well, I hope that you have learned something from this tutorial, and maybe even use such a rollover effect in your web sites!

Please feel free to comment on this tutorial, if you noticed anything wrong or out of place in this tutorial, please don't hesitate to mention it!
I am interested in all feedback really, I'm curious about what you think of my writing, tutorial, methods used, code, etc.. Thanks!


See a working Sample of this Script!

Download a ZIP containing all working files in this tutorial!

biggrin.gif

 

 

 


Comment/Reply (w/o sign-up)

pilgrim_of_mini-monkeys
Thanks for that. However, I get the smell of it being closely linked in with Dreamweaver's Javascript image swap code example.

Comment/Reply (w/o sign-up)

SystemWisdom
Well, I have never used DreamWeaver before, nor I have I ever used any WYSIWYG Editor for my HTML/JS/CSS/Etc..

But I did a search on "DreamWeaver Image Swap" and this is an example I found:
CODE

   <HEAD>
     <TITLE>Menu</TITLE>
   <script language="JavaScript">
   <!--
   function MM_preloadImages() { //v1.2
     if (document.images) {
       var imgFiles = MM_preloadImages.arguments;
       var preloadArray = new Array();
       for (var i=0; i<imgFiles.length; i++) {
         preloadArray[i] = new Image;
         preloadArray[i].src = imgFiles[i];
       }
     }
   }

   function MM_swapImage() { //v1.2
     var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.MM_swapImgData;
     for (i=0; i < (MM_swapImage.arguments.length-2); i+=3) {
       objStr = MM_swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];
       if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||
           (objStr.indexOf('document.all[')   ==0 && document.all   ==null))
         objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);
       obj = eval(objStr);
       if (obj != null) {
         swapArray[j++] = obj;
         swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];
         obj.src = MM_swapImage.arguments[i+2];
     } }
     document.MM_swapImgData = swapArray; //used for restore
   }

   function MM_swapImgRestore() { //v1.2
     if (document.MM_swapImgData != null)
       for (var i=0; i<(document.MM_swapImgData.length-1); i+=2)
         document.MM_swapImgData[i].src = document.MM_swapImgData[i+1];
   }
   //-->
   </SCRIPT>


   </HEAD>

   <BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#3366ff"  VLINK="#003399" ALINK="#0000ff">

   <!-- #BeginBehavior MM_swapImage20 -->
   <script language='JavaScript'>

     MM_preloadImages('graphics/buttons/english_home_yellow.jpg');

     MM_preloadImages('graphics/buttons/courses_yellow.jpg');

     ... and so on
   
   </SCRIPT>


   <A href="index.html" target="_top" onMouseOver="MM_swapImage('document.home','document.home','graphics/buttons/english_home_yellow.jpg','MM_swapImage1')" onMouseOut="MM_swapImgRestore()"><IMG ALIGN=Top SRC="graphics/buttons/english_home_white.jpg" BORDER="0" WIDTH="110" HEIGHT="20" ALT= "Return to the English Home Page" name="home"></A>

</BODY>
</HTML>


Looking at that, I would have to argue that mine is alot different (and simpler).. Is there any other Image Swap code DreamWeaver produces?

Either way, I like my method better, it is cleaner and easier to read/understand.. not to mention alot shorter in code...

Anyway, I hope you liked my tutorial!! biggrin.gif

 

 

 


Comment/Reply (w/o sign-up)

pilgrim_of_mini-monkeys
I like your method. Just first glances made me think it was adapted from the Dreamweaver one. And I only use it to write my CSS and test it directly with my sites.

And yes, your tutorial is great.

Comment/Reply (w/o sign-up)

GladToBeGrey
I really like your code smile.gif I've also used and slightly adapted adapted your preloading script, posted elsewhere here, to pass a relative Path parameter for all the images, rather than have to specify it for each image, extend the progress bar to 20 dots, and add a % loaded message and image count ( 'n' of 'm') to the progress page.

My question is: could the two be easily combined to work together, such that the image rollover makes use of the image objects array created in the preload script? Perhaps by giving each image preloaded an identifiable name to tie up the array element with the image?

Thanks.

Comment/Reply (w/o sign-up)

Inspiron
Its all the same thing... Naming it Image Swap or whatever but it still produce the same output..
Basically the script changes an image upon a mouse over it event. That's a simple animation that web developers play with..
If you really understand that script, you can even use the same method to change images when the website is loaded or any other related..

The idea is very simple.. but it is just written in a complicated way.. smile.gif
In fact just 3 lines can do the job..

Comment/Reply (w/o sign-up)

LanarkshirePets
Great tutorial, I use a similar one that's a bit easier to use though. It's cool to see how other people write their code smile.gif

Comment/Reply (w/o sign-up)

Dooga
I really like that tutorial, but I've noticed that preloading images slows loading speed down. I recently swiched to CSS rollovers, and I think it was quite successful.

Comment/Reply (w/o sign-up)

Sprnknwn
Thanks for this tutorial. I see it very useful indeed. smile.gif

Comment/Reply (w/o sign-up)

Eikon
Very useful tutorial. I didn't get lost at all biggrin.gif Hopefully I can use this for my next website or help my friend out with his.

Comment/Reply (w/o sign-up)

Latest Entries

MCSESubnet
If you find yourself unable to use javascript, or desire an alternative.

I would suggest using CSS. here is the basic idea of what you need in your CSS entry.

CODE
link_text    

    {/*make the link text transparent*/
        visibility: hidden;
    }

.link_href
    {/*Display this image in the link area*/
        background: url(imagepath/mouseout_button.gif) no-repeat;
    }
        
.link_href:hover
    {/*Display this image in the link area when you mouseover*/
        background: url(imagepath/mouseover_button.gif) no-repeat;
    }



Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : image, rollovers, javascript, write, approach

  1. Lesser Known Useful Javascript Features
    (2)
  2. Make A Moderately-secure Password System Using Javascript
    using file redirection to hide the password. (11)
    JavaScript is very handy at making forms, allowing for much more customization and easier ways to
    send data. So making Login forms using JavaScript may seem to many to be a very feasable idea.
    However, JavaScript is very bad at protecting Passwords, as since the passwords are not encypted and
    the whole JavaScript code is in the page, a person could just view the Page Source and find out
    everything. Even if you use an external JavaScript, it would still be poor as the file name for the
    external JavaScript would still be revealed. But I have an answer! There is a relative....
  3. Simple Javascript And Password System
    How to protect your pages with password (10)
    The quickest way to get a password protection system up and running is to use a Prompt box in
    JavaScript that has a title like "Enter your Email Address". Only you and the relevant users know
    what the password should be, could even be one each, that can be sorted out at the next page then
    pass the "input" directly through the url by changing the .href, like
    http://www.iSource.net.nz/users/?leTmeIn= The page that then processes this should also check for
    the referring page, and three fails from an IP if you like the php (the next page): CODE //
    processdownloads.p....
  4. Create A Simple Html Editor With Php And Javascript
    (3)
    Ok, I will teach you how to create a simple HTML editor that runs online with buttons that add HTML
    tags. Before we start: You should have basic knowledge of these languages. HTML/XHTML
    Javascript PHP You will need Ability to use filesystem functions. Chmodding abilities
    Features of Editor Online PHP safe Full HTML support A Few Bad Features Can only create new
    documents or overwrite Fairly unsafe Now we are ready to begin. The PHP Script This will be
    our PHP script that we will use to make the file. Make a file called save.php Here is the....
  5. Background Image Swap Script
    Change a Background Image based on clock time (15)
    Background Image Changer Script To swap the background image from your CSS file according to the
    Server Clock Time. 1.) In your CSS file, add the following rule: CODE body {     background:
    url(time.png); } 2.) Create a "folder" named time.png. 3.) Into the folder, place three images
    named morning.png, day.png, night.png. 4.) Also, in the same folder, create an index.php file and
    copy/paste the following script. CODE $hour = date('H'); if ($hour     $image =
    "morning.png"; } elseif ($hour      $image = "day.png"; } else {      $image = "night.pn....
  6. Image Rotator Script (another One)
    easy to implement (0)
    In case you haven't noticed, I have a different Avatar display on the Forum each time the page
    is refreshed. /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif"
    /> For those of you who might want the script to do that, here is the one I am using: HTML
    $filesp = glob('*.png'); if(empty($filesp)){ echo 'no images found...die br >';
    die(); } else{ foreach ($filesp as $file) { $img_array = trim($file); } } shuffle($img_array);
    //select image at random header("C o n t e n t{dash}t y p e: image/png"); // replace th....
  7. Mootools - My Favourite Javascript Library
    (3)
    It kind of amazes me that there's not even a mention of the Mootools javascript library
    throughout this whole forum. So here I'll do a brief introduction and a tutorial on how to
    produce the famous accordion effect. MooTools is a compact, modular, Object-Oriented javascript
    framework designed to make writing extensible and compatible code easier and faster. MooTools lets
    you get the job done efficiently and effectively. It is slightly based on the powerful Prototype
    javascript framework , of which Scriptaculous runs on. (But frankly, I dislike Scriptaculou....
  8. Javascript Scroll Bar
    A scroll bar for your webpage using javascript (13)
    In this tutorial I will show you how to create two buttons in the bottom left of the screen that,
    when hovered over, will scroll the page. Now to start with, we must create a our buttons, the first
    line will create a div element, or block. Using blocks you can position items anywhere on a page.
    We use the ID property just to let us know what the block is used for, as for the first block, its
    obvious that it contains the vertical buttons and the second two blocks contains the horizontal
    buttons. The style property of the div tag tells the browser how to draw it, in the....
  9. Math Captcha Image Validation
    (10)
    This tutorial will show you how to make a basic math CAPTCHA validtion form. This requires that you
    have the GD library for PHP installed to work. This tutorial requires 2 files, login.php and
    action.php. The first step is to create a sub-folder to store the temporary images, for the
    purposes of this tutorial,this folder should be called images. Now upload a image in there called
    verify.php and chmod just that image(not the folder) to 777 so that image can change as our
    functions generate new images. Ok, after you've done that, we can get to the code: in login.p....
  10. A Simple Php Captcha - Image Validation
    (27)
    OK, I recently had the need to create a PHP CAPTCHA system for a friend, and I am sharing this as a
    tutorial with the good people here at Trap17. I am sure you have all seen a CAPTCHA before (although
    you may not have known what it was called). They are the little codes you often have to enter when
    you register with a site, to make sure you are a person and not an automated script. Some common
    examples look something like this: My system doesn't really do anything as fancy, but I
    think that it is slightly more readable that some of those that get generated. Every....
  11. Simple Scripts In Html And Javascript
    Things like BackgroundColorChanger and so (7)
    like in the topic, here is a description how to change the Backgroundcolor "On The Fly", by klicking
    on a button or radio-box first, we ned the html-and body-tags, create a new html-file on your
    desktop and write the following: QUOTE browser interpretation: html - tag
    means "hey, browser, here comes HTML" in the body-tag you define the looking of your site. you can
    add things like "bgcolor" for the background, "text" for the textcolor and link / alink / hlink /
    vlink to define the linkcolor ( ) the scripttag is the tag, we'll need now (sorr....
  12. Image Gallery Tutorial Using Hoverbox
    A php solution to coding the Hoverbox Image Gallery (15)
    As reported in another posting , there is an Image Gallery named Hoverbox from the Sonspring site
    which is a pretty cool display method using CSS to have Thumbnail pictures double their size by
    hovering over them. I liked the css included in the original Tutorial as found on the Sonspring
    site , but I knew there was more than one use for the Hoverbox and took it upon myself to explore
    the use of the Hoverbox on a site I webmaster. One thing that wasn't right was having to
    hardcode the image tags, so the first version I wrote used php to fill the Hoverbox by rea....
  13. How To Make Image To Highlight When It`s Mouseovered
    (8)
    Place this code between and tags. CODE function makevisible(cur,which){
    strength=(which==0)? 1 : 0.2 if (cur.style.MozOpacity) cur.style.MozOpacity=strength else if
    (cur.filters) cur.filters.alpha.opacity=strength*100 } // --> Place the following code within
    all of the image tags you'd like the effect to be applied. CODE
    style="filter:alpha(opacity=20);-moz-opacity:0.2" onMouseover="makevisible(this,0)"
    onMouseout="makevisible(this,1)" And your image tag might look like that. CODE
    "yourimage.gif" in last code change to your ....
  14. Javascript Framework - A Shortcut Javascript
    a shortcut javascript (3)
    hi, today im going to give you small tutorial how to use `Prototype JavaScript Framework` 1st you
    have to download `Prototype JavaScript Framework`library from http://prototype.conio.net/
    prototype makes easy to using Javascript, ex : when you want to point (get) the element from HTML
    usually we use : CODE document.getElementById('elementId') with prototype we use
    CODE $('elementId') , yeah...world getting small..with prototype. example we`re going
    to get value from an element of CODE with prototype we use CODE alert(....
  15. Image Shack Mod
    For Invision Power Board (2)
    Image Shack Mod For Invision Power Board ''These instructions will help you to install
    'ImageShack on your Site' into the reply, quick-reply, and post-new-thread sections of your
    Invision Power Board, thus giving your visitors the ability to upload images directly. After upload,
    they may paste the images directly into their post box.'' CODE These instructions will
    help you to install 'ImageShack on your Site' into the reply, quick-reply, and
    post-new-thread sections of your Invision Power Board, thus giving your visitors the ability ....
  16. Creating A Simple Image Viewer
    Using Visual Basic 2005 Express Edition (4)
    I downloaded Microsoft's Visual Studio Express suite a few months ago, but only recently got
    around to installing it. I have been practising with Visual Basic and making some rather basic
    programs and utilities, but they contain most of the basic concepts. This tutorial will explain how
    to create a basic image viewer, and I will try to explain each step from beginning to end as clear
    as I can. To start you will need: Microsoft Visual Studio About 10-20 minutes free time OK,
    first open up the Visual Basic part of the Studio. I am using the 2005 Express version, so....
  17. Tool Tips Using Only Css To Pop Up The Tool Tip
    No javascript involved! (8)
    Tool Tip Tutorial Example Found Here . Please review before continuing. Nice. And no
    javascript at all to be found. The colours I have used are for demonstration purposes only to show
    you that they are adjustable to suit the background or to contrast against them. Your choice. That
    is a styling issue. It is your site, you decide. The original author's idea was to add
    position:relative to the link, in order to allow the span element inside to position absolutely
    in respect to the parent link. This code has been tested in Ie5.5, IE6, Opera7.11 and M....
  18. Handy Javascript Code Snips
    Ready to Apply in your webpage (5)
    /tongue.gif' border='0' style='vertical-align:middle' alt='tongue.gif' /> Some common things to
    implement in our webpage very frequently are as follows. How to implement all these I am going to
    tell you in this tutorial. Add To Favorite Set As Homepage Go To Top Of Page No Right Click
    Print Page Adding Current Date Adding Current Time Pop-Up Page Creation Closing Window
    Copyright Notice Updation 01. Add To Favorite Someone may be interested in the content of your
    page. Offer him/her to add the page in his/her favorite menu. To do this you have ....
  19. How To Stop Image Hot Linking
    for a selected directory. (17)
    Those of you that don't know what is meant by 'hotlinking', it is when someone directly
    links to an image on your site so it will display on their site. This is what is called
    'bandwidth theft' and being as accounts here have a limit on bandwidth, your bandwidth limit
    could be exceeded by someone else hotlinking to your images. As most users of cPanel will know,
    there is an option to disable hotlinking of images in the "Site Management Tools" section.
    However, this disables hotlinking to all directories, what if you only want to disable hotlinki....
  20. Css And Javascript Combined For Dynamic Layout
    use of different CSS files at same site (9)
    This tutorial is meant for people that are dealing with problems while coding their site at 100% of
    width. Important notice: Some people has JavaScript disabled, so they will not be able to load CSS
    file (take this in account when creating your website). How this script works. In the HEAD of your
    HTML document will apply this command, so variable.js file will be load at start: CODE
    In browser JavaScript file variable.js is loaded. This Javascript file consist of this parameters,
    copy this code and name it variable.js CODE // JavaScript Document if (sc....
  21. How To: Change An Image When A User Clicks On It
    using both php and javascript (12)
    How To: Change An Image When A User Clicks On It using both php and javascript - a powerful
    combination I have seen quite a few how tos offering a method of doing this but none of which
    resembled my method of making use of both php and javascript. This code is fairly repetitive and
    most of the functions are easy to pick-up if you haven't heard of them before. Here it is...
    Create your two images. Call them anything you like, you'd just need to change their filenames
    in $imgano $imgayes. In fact with this script you can easily create more than one pair....
  22. Creating Rollovers With Buttons
    Short & simple javascript tutorial that shows you how. (2)
    Javascript in action can render some very neat visual effects, which can make your website more
    appealing, and sometimes even easier to navigate. Among the most common effects are the
    'button' effect, and the mouseover effect. The buttons are very common, of course; if
    nowhere else, most of us have seen them at the end of forms (Click the 'submit' button to
    proceed...). The basic idea is to have a 'depressible' object, which can give you the
    illusion that you're 'pressing' it when you click it. The rollover effect causes
    something to h....
  23. Extending The Image Preloader With Php4
    Dynamically adds your images to Preloader! (3)
    Tutorial: Extending the Image Preloader with PHP4, by Rob J. Secord, B.Sc. (SystemWisdom)
    Second Tutorial in a Series of 2 Tutorials! Be sure to have read the First One here: "Image
    Preloader With Progress Bar Status" See a working Sample of this Script! (Note: Preloads 100
    images, some images are larger than others, and may take awhile for some people.) Description :
    A Tutorial for Extending the Image Preloader with PHP4 to Dynamically Populate the Array of
    Preloaded Images. This tutorial is the second in a series of 2 tutorials, and assumes that y....
  24. Image Preloader With Progress Bar Status
    Pure Client-Side JavaScript tested in 4 Browsers! (28)
    Tutorial: Image Preloader with Progress Bar, by Rob J. Secord, B.Sc. (SystemWisdom)
    Description : A Tutorial for a Client-Side Image Preloader with Dynamic Real-Time Progress Bar
    Indicator written in JavaScript! Tested to work with 4 Major Internet Browsers: Firefox, MSIE,
    Netscape, Opera (Complete sample solution provided at end of tutorial, just put it on your
    web-server, add your images and go!) Intended Audience : Beginner to Intermediate Web
    Developers. Although this tutorial will cover some advanced aspects of JavaScript, I will try to
    explain it all ....
  25. Roll-over Image Links With Css
    No preloading of images (2)
    Here is a way of having roll over image links without preloading images by using CSS and a table.
    It's very useful for a list of links as in a side bar menu or header. It also solves not having
    to make a seperate image for each different link by placing the desired text over the image. 1.
    First you need an image which comprises of the main link image, the 'mouse over' image link
    underneath plus you can have another for visited links. As for most roll over images, the images
    should be the same size. The above example - button.gif is 100x60px with each lin....
  26. A Little Introduction To 3d Studio Max
    How to make a simple abstract image (11)
    This tutorial will teach you the basics of making abstract images in 3D studio max. In this example,
    I used a simple sphere, and applied the “Noise” modifier. Then, I applied a transparent, blue,
    plastic-like material to spice up the whole thing. Let’s start. First, make a sphere by selecting
    the “Sphere” button in the “Standard Primitives” section, and draw somewhere in the center of the
    perspective view. We will set the size of the sphere later on. The sphere I made looks like this,
    yours can be different in size and color, but the only thing that is important is to....
  27. Easy Image Rotate Tutorial
    (0)
    Well, since I'm new, I don't know what has been posted and what hasn't, so here's an
    easy-to-use php tutorial! CODE @header("Pragma: nocache"); $URL1="Your Image Source";
    $URL2="Your Image Source"; $URL3="Your Image Source"; $URL4="Your Image Source"; $URL5="Your Image
    Source"; srand((double) microtime() * 1000); $random = rand(1,5); if($random == 1) @header
    ("Location: $URL1"); elseif ($random == 2) @header ("Location: $URL2"); elseif ($random == 3)
    @header ("Location: $URL3"); elseif ($random == 4) @header ("Location: $URL4"); elseif ($random ==....
  28. Simple Image Rotator
    randomly rotate images (6)
    First, It's really confusing. Do you know any tutorials on Image Manipulation on PHP?
    Here's another simple one: 1. Create a 5 image. 2. Rename them to something like:
    image1.jpg; image2.jpg; and so on... 3. Create your PHP file (rotation.php) 4. Enter the
    following code: CODE header("content-type: image/jpeg");
    readfile("image".mt_rand(1,3).".jpg"); ?> 5. Execute your script.....
  29. Opening New Tabs With Javascript
    (1)
    I just spent a couple of hours trying to figure out how to open new tabs from a Firefox sidebar. I
    found lots of different suggestions but none worked. Well finally I found this and it works. var
    browser = top.document.getElementById("content"); var tab = browser.addTab("http://www.google.com");
    An even better way of doing it is through: const kWindowMediatorContractID =
    "@mozilla.org/appshell/window-mediator;1"; const kWindowMediatorIID =
    Components.interfaces.nsIWindowMediator; const kWindowMediator = Components.classes
    .getService(kWindowMediatorIID); var browserWi....

    1. Looking for image, rollovers, javascript, write, approach
Similar
Lesser Known Useful Javascript Features
Make A Moderately-secure Password System Using Javascript - using file redirection to hide the password.
Simple Javascript And Password System - How to protect your pages with password
Create A Simple Html Editor With Php And Javascript
Background Image Swap Script - Change a Background Image based on clock time
Image Rotator Script (another One) - easy to implement
Mootools - My Favourite Javascript Library
Javascript Scroll Bar - A scroll bar for your webpage using javascript
Math Captcha Image Validation
A Simple Php Captcha - Image Validation
Simple Scripts In Html And Javascript - Things like BackgroundColorChanger and so
Image Gallery Tutorial Using Hoverbox - A php solution to coding the Hoverbox Image Gallery
How To Make Image To Highlight When It`s Mouseovered
Javascript Framework - A Shortcut Javascript - a shortcut javascript
Image Shack Mod - For Invision Power Board
Creating A Simple Image Viewer - Using Visual Basic 2005 Express Edition
Tool Tips Using Only Css To Pop Up The Tool Tip - No javascript involved!
Handy Javascript Code Snips - Ready to Apply in your webpage
How To Stop Image Hot Linking - for a selected directory.
Css And Javascript Combined For Dynamic Layout - use of different CSS files at same site
How To: Change An Image When A User Clicks On It - using both php and javascript
Creating Rollovers With Buttons - Short & simple javascript tutorial that shows you how.
Extending The Image Preloader With Php4 - Dynamically adds your images to Preloader!
Image Preloader With Progress Bar Status - Pure Client-Side JavaScript tested in 4 Browsers!
Roll-over Image Links With Css - No preloading of images
A Little Introduction To 3d Studio Max - How to make a simple abstract image
Easy Image Rotate Tutorial
Simple Image Rotator - randomly rotate images
Opening New Tabs With Javascript

Searching Video's for image, rollovers, javascript, write, approach
See Also,
advertisement


Image Rollovers In Javascript - A Write-Once, Use-Anywhere Approach

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com