Implement the change of IMG picture through the onmouseover tab _javascript tips

Source: Internet
Author: User
Copy Code code as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http:// ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> tab to implement the transform of IMG image </title>
<style type= "Text/css" >
#main {height:420px; width:400px;}
#head {
Top: -12px;
#head li{float:left; list-style:none; width:85px;}
#content {
Background-color: #FC6;

<div id= "Main" >
<div id= "Head" >
<li id= "Tab1" onmouseover= "Show (1)" style= "Background-color: #FFF" > Picture one </li>
<li id= "TaB2" onmouseover= "Show (2)" > Picture two </li>
<li id= "Tab3" onmouseover= "Show (3)" > Picture three </li>
<li id= "TAB4" onmouseover= "Show (4)" > Picture four </li>
<div id= "Content" >
<p id= "P1" ></p>
<p id= "P2" style= "Display:none;" ></p>
<p id= "P3" style= "display:none;" ></p>
<p id= "P4" style= "Display:none;" ></p>
function Show (n) {
for (Var i=1;i<=4;i++) {
document.getElementById ("tab" +i). style.backgroundcolor= ' green ';
document.getElementById ("P" +i). style.display= ' None ';
Display to achieve the content of the hidden or not control, when none is, hide
document.getElementById ("tab" +n). style.backgroundcolor= ' White ';
document.getElementById ("P" +n). style.display= ' block ';
When block is hidden, it can be displayed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.