标题:一个关于javascript选项卡效果的问题
只看楼主
su47jindiao
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-8-28
结帖率:100%
 问题点数:0 回复次数:0 
一个关于javascript选项卡效果的问题
在网上抄的代码。代码如下,能够正确运行。现在我想在每个标注了汉字数字的区域(一、二、...十)都添加table就不好使了,哪位高手给指点一下怎么实现在每个标注了汉字数字的区域(一、二、...十)都添加table啊?很重要啊,着急,谢谢!




<%@ Control Language="C#" AutoEventWireup="true" CodeFile="InputDocumentType.ascx.cs" Inherits="UserControl_InputDocumentType" %>
<%@ Register Src="InputCondition.ascx" TagName="InputCondition" TagPrefix="uc1" %>
<table width="650" border="0" cellspacing="1" cellpadding="4" align="center">
  <tr>
    <td width="23.5%" align="right"> <span id="weizi">A展馆1楼展厅</span></td>
    <td width="76.5%"></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="650" id="secTableA">
        <tr style="height:20" align="center">
          <td class="sec1" id="A6"  onclick="secBoard()">A展馆1楼展厅</td>
          <td class="sec1" id="A7" onclick="secBoard()">B展馆1楼展厅</td>
          <td class="sec1" id="A8" onclick="secBoard()">B展馆2楼展厅</td>
          <td class="sec1" id="A9" onclick="secBoard()">C展馆1楼展厅</td>
          <td class="sec1" id="A10" onclick="secBoard()">C展馆2楼展厅</td>
        </tr>
      </table>
      <table border="0" cellspacing="0" cellpadding="0" width="650" id="secTableB">
        <tr style="height:20" align="center">
          <td class="sec2" id="B1" onclick="secBoard()">A展馆1楼展厅</td>
          <td class="sec1" id="B2" onclick="secBoard()">A展馆2楼展厅</td>
          <td class="sec1" id="B3" onclick="secBoard()">B展馆1楼展厅</td>
          <td class="sec1" id="B4" onclick="secBoard()">B展馆2楼展厅</td>
          <td class="sec1" id="B5" onclick="secBoard()">C展馆1楼展厅</td>
 
        </tr>
      </table>

      <table border="0" cellspacing="0" cellpadding="0" width="650" style="height:200" id="mainTable" class="main_tab">
        <tbody style="display:block;" id="c0">
        <tr>
          <td align="center" style="height: 300px"> 一<br />
            
          </td>
        </tr>
        </tbody>
        <tbody style="display:none;"  id="c1">
        <tr>
          <td align="center" style="height: 300px">
            二
              <br />
           
           
          </td>
        </tr>
        </tbody>
        <tbody style="display:none;"  id="c2">
        <tr>
          <td align="center" style="height: 300px">
            三<br />
              &nbsp;</td>
        </tr>
        </tbody> <tbody style="display:none;"  id="c3">
        <tr>
          <td align="center" style="height: 300px">
            四<br />
              &nbsp;</td>
        </tr>
        </tbody><tbody style="display:none;"  id="c4">
        <tr>
          <td align="center" style="height: 300px">
            五<br />
              <br />
          </td>
        </tr>
        </tbody>
     
        <tbody style="display:none;"  id="c5">
        <tr>
          <td align="center" style="height: 300px">
            六
              <br />
          </td>
        </tr>
        </tbody><tbody style="display:none;"  id="c6">
        <tr>
          <td align="center" style="height: 300px">
            七
              <br />
          </td>
        </tr>
        </tbody><tbody style="display:none;"  id="c7">
        <tr>
          <td align="center" style="height: 300px">
            八
              <br />
          </td>
        </tr>
        </tbody><tbody style="display:none;"  id="c8">
        <tr>
          <td align="center" style="height: 300px">
            九
              <br />
          </td>
        </tr>
        </tbody><tbody style="display:none;"  id="c9">
        <tr>
          <td align="center" style="height: 300px">
            十
              <br />
          </td>
        </tr>
        </tbody>
      </table>

<script type="text/jscript" 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;
    var m = getCode(lastObj);
    var p = getCode(n);
    var st1=eval()
    var t = document.getElementById(m);
    var q = document.getElementById(n);
  
    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>
搜索更多相关主题的帖子: javascript 效果 选项 
2009-08-28 16:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-283981-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.181550 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved