Implement double-layer tab switching using javascript

Source: Internet
Author: User
Tags eval
Tip: you can modify some code before running

<html><head><title>New Document</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta name="Generator" content="EditPlus"><meta name="Keywords" content=""><meta name="Description" content=""><style type="text/css">Body, table, tr, td {font-size: 12px; color: #000000 ;}. sec1 {background-color: #99CC99; cursor: hand; color: #000000; border-left: 1px solid # FFFFFF; border-right: 1px solid gray; border-bottom: 1px solid # FFFFFF }. sec2 {background-color: # D4D0C8; cursor: hand; color: #000000; border-left: 1px solid # FFFFFF; border-right: 1px solid gray; font-weight: bold ;}. main_tab {background-color: # D4D0C8; color: #000000; border-left: 1px solid # FFFFFF; border-right: 1px solid gray; border-bottom: 1px solid gray ;}</style> </head> <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0"> <table width="588" border="0" cellspacing="1" cellpadding="4" align="center"> <tr> <td width="82%">Current location: Exhibition Hall distribution> Exhibition Hall on the first floor of Hall</td> <td width="18%"></td> </tr> <tr> <td colspan="2" height="1" bgcolor="#000000"></td> </tr> <tr> <td colspan="2" height="4"></td> </tr> <tr> <td colspan="2"> <table border=0 cellspacing=0 cellpadding=0 width=578 id=secTableA> <tr height=20 align=center> <td class=sec1 id="A7" onClick="secBoard()">Exhibition hall on the first floor of Hall</td> <td class=sec1 id="A8" onClick="secBoard()">Exhibition hall on the first floor of Hall B</td> <td class=sec1 id="A9" onClick="secBoard()">Exhibition hall on the second floor of Hall B</td> <td class=sec1 id="A10" onClick="secBoard()">Exhibition hall on the first floor of Hall C</td> <td class=sec1 id="A11" onClick="secBoard()">Exhibition hall on the second floor of Hall C</td> </tr> </table> <table border=0 cellspacing=0 cellpadding=0 width=578 id=secTableB> <tr height=20 align=center> <td class=sec2 id="B1" onClick="secBoard()">Exhibition hall on the first floor of Hall</td> <td class=sec1 id="B2" onClick="secBoard()">Exhibition hall on the second floor of Hall</td> <td class=sec1 id="B3" onClick="secBoard()">Exhibition hall on the first floor of Hall B</td> <td class=sec1 id="B4" onClick="secBoard()">Exhibition hall on the second floor of Hall B</td> <td class=sec1 id="B5" onClick="secBoard()">Exhibition hall on the first floor of Hall C</td> <td class=sec1 id="B6" onClick="secBoard()">Exhibition hall on the second floor of Hall C</td> </tr> </table> <table border=0 cellspacing=0 cellpadding=0 width=578 height=160 id=mainTable class=main_tab> <tbody > <tr> <td align="center">I</td> </tr> </tbody> <tbody > <tr> <td align="center">II</td> </tr> </tbody> <tbody > <tr> <td align="center">3.</td> </tr> </tbody> <tbody > <tr> <td align="center">Thu</td> </tr> </tbody><tbody > <tr> <td align="center">V.</td> </tr> </tbody><tbody > <tr> <td align="center">Sat.</td> </tr> </tbody><tbody > <tr> <td align="center">VII.</td> </tr> </tbody><tbody > <tr> <td align="center">8</td> </tr> </tbody><tbody > <tr> <td align="center">9</td> </tr> </tbody><tbody > <tr> <td align="center">10</td> </tr> </tbody><tbody > <tr> <td align="center">11th</td> </tr> </tbody> </table><!--放在这里安全点 #:-) --><script language="javascript"><!--var lastObj="B1",strClassBlur="sec1",strClassActive="sec2";var tbody=document.getElementById("mainTable").getElementsByTagName("TBODY");var secTableA=document.getElementById("secTableA");var secTableB=document.getElementById("secTableB");function secBoard(){var n=event.srcElement.id;if(lastObj == n)return;if(n.charAt(0) != lastObj.charAt(0)) secTableA.swapNode(secTableB);eval(n).className=strClassActive;titleChange(eval(n).innerText);eval(lastObj).className=strClassBlur;tbody[getNum(lastObj)].style.display="none";tbody[getNum(n)].style.display="block";lastObj=n;}function getNum(str){return parseInt(str.substr(1))-1;}function titleChange(text){weizi.innerText=text;}//--></script> </td> </tr></table> </td> </tr></table>
Tip: you can modify some code before running
Related Article

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: info-contact@alibabacloud.com 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.