Home > User Guide

How to Change a Background on Your Webpage when onClick, onMouseOver or onMouseOut?

Below is the result we want to achieve through SliceMaker products:

When your mouse hovers over the blue background, the blue background will be changed to the black background ------- When your mouse moves away the blue background, the blue background will be back to its original.

 

                         [View the demo]                  [Download the demo]

 

You can also view a completed web page created by SliceMaker products to see how this function works for a completed web page.

 

                                                                                            [View the demo]                               [Download the Demo]

 

 

 

The following tutorial will teach you how to change background on hover, it includes two parts:



 

 

 

 Part 1: How to Change the Blue Background to Black Background onMouseOver?

 

 Step 1: Select the Slice that Contains the Blue Background.

 

 

Note: The slice we select should be set as background attribute (If you doní»t know how to set a slice as background attribute, please view this tutorial).

 

 

 

 Step 2: Choose an Event - onClick, onMouseOver or onMouseOut

Here we will choose onMouseOver event.

 

 

onMouseOver event here will determine when a visitorí»s mouse hovers over the blue background, the blue background will be changed to black background.

onClick event here will determine when a visitorí»s mouse clicks the blue background, the blue background will be changed to black background.

onMouseOut event here will determine when a visitorí»s mouse moves away from the blue background, the blue background will be changed to black background.

 

 

 

 Step 3: Click the Add Button to Choose the Corresponding JavaScript Effect

 

 

 

 

 Step 4: Click the Corresponding JavaScript Effect Button You Want to Choose

After clicking the JavaScript Effect button -  , a dialog box will appear asking us to select an image. The selected image will be used as the changed background when onMouseOver.

Here, we will select the black image so that the changed background will be black.

 

 

 

Note:

1) Please firstly prepare a black background image which has nearly the same size as the blue background image.

2) Please save the black background image to the file folder which you have set as Website Root Directory or its sub folder.

 

 

 Step 5: Generate and Preview

After finishing the above settings, please click the generate button. You will immediately see that when your mouse hovers over the blue background, the black background will appear.

 

 

 

 

 

 Part 2: How to Restore the Blue Background onMouseOut?

The way to restore the blue background onMouseOut is nearly the same to change the blue background to black background onMouseOver.

 

 

 Step 1: Select the Slice that Contains the Blue Background.

 

 

 

 

 Step 2: Choose an Event - onClick, onMouseOver or onMouseOut

Here we will choose onMouseOut event.

 

 

 

 

 Step 3: Click the Add Button to Choose the Corresponding JavaScript Effect

 

 

 

 

 Step 4: Click the Corresponding JavaScript Effect Button You Want to Choose

After clicking the JavaScript Effect button -  , a dialog box will appear asking us to select an image.

Here, we will select the blue background image so that the restoring background will be blue:

 

 

 

 

 

 Step 5: Generate and Preview

Thatí»s all! The desired result we want to achieve has already been created.

 

 

 

 

 

 Contact Us for Help

If you cannot find a proper solution to your issue through the above methods, our support team is always on standby for whatever problems youí»ve got. We promise to you we will deal with your issues within 24 hours. Contact Our Support Team

 

 

 

 

Whatí»s Next:



Choose a SliceMaker Product to Create a Website on Your Own-30 Day Freetrial
SliceMaker Standard V3.6 - Freeware
The anyone-can-master webpage making software. You can create exceptional webpage/website on your own even if you're unfamiliar with webpage making.
$0
$0
SliceMaker Platinum V3.6 - Freeware
The bestselling webpage making software, helps you create exceptional webpage/website without writing complicated CSS and DIV codes.
$0
$0
SliceMaker Deluxe V3.6 - Freeware
The all-in-one webpage making software, helps you create webpage/website of any style. It's the idea tool to create webpage/website.
$0
$0