javascript tab選項卡實現切換載入其它頁面方法

來源:互聯網
上載者:User
提示:您可以先修改部分代碼再運行

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>標籤樣本</title><style type="text/css">body { font-size:14px; font-family:"宋體"}ol li { margin:8px}#con { font-size:12px; width:600px; margin:0 auto}#tags { height:23px; width:400px; margin:0; padding:0; margin-left:10px}#tags li { float:left; margin-right:1px; background:url(http://www.happyshow.org/sample/20061108/images/tagleft.gif) no-repeat left bottom; height:23px; list-style-type:none}#tags li a { text-decoration:none; float:left; background:url(http://www.happyshow.org/sample/20061108/images/tagright.gif) no-repeat right bottom; height:23px; padding:0px 10px; line-height:23px; color:#999}#tags li.emptyTag { width:4px; background:none}#tags li.selectTag { background-position: left top; position:relative; height:25px; margin-bottom:-2px}#tags li.selectTag a { background-position: right top; color:#000; height:25px; line-height:25px;}#tagContent { padding:1px; background-color:#fff; border:1px solid #aecbd4;width:100%;}.tagContent { background:url(http://www.happyshow.org/sample/20061108/images/bg.gif) repeat-x; height:350px; padding:10px; color:#474747; width:576px; display:none}#tagContent div.selectTag{ display:block}.tagFrame{ background:url(http://www.happyshow.org/sample/20061108/images/bg.gif) repeat-x;}</style><SCRIPT LANGUAGE="JavaScript"><!--function getTab(flag) { var elList, i; elList = document.getElementsByTagName("li"); for (i = 0; i < elList.length; i++){ elList[i].className =""; } elList[flag].className ="selectTag"; elList[flag].blur();}function goto(flag){if("0"==flag){document.all.tabIframe.src="http://www.111cn.net";}else if("1"==flag){document.all.tabIframe.src="http://www.111cn.net";}else if("2"==flag){document.all.tabIframe.src="http://www.111cn.net";}getTab(parseInt(flag));}//--></SCRIPT></head><body><h1>標籤樣本</h1><div id="con"> <ul id="tags"> <li>標籤一</li><li class="selectTag">標籤二</li><li>自適應寬度的標籤</li> </ul> <div id="tagContent"> <!-- <div id="tagContent0" class="tagContent">第一個標籤的內容</div><div id="tagContent1" class="tagContent selectTag">第二個標籤的內容</div><div id="tagContent2" class="tagContent">第三個標籤的內容</div> --><iframe class="tagFrame" name="tabIframe" src="http://www.google.com" marginheight="8" marginwidth="8" frameborder="0" width="100%" height="100%"></iframe> </div></div><script type="text/javascript">function selectTag(showContent,url,selfObj){// 操作標籤var tag = document.getElementById("tags").getElementsByTagName("li");var taglength = tag.length;for(i=0; i<taglength; i++){tag[i].className = "";}selfObj.parentNode.className = "selectTag";}</script></body></html></td> </tr></table>
提示:您可以先修改部分代碼再運行

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.