在你的網(wǎng)頁(yè)中嵌入外部網(wǎng)頁(yè)的方法
Description: Using a tabbed interface, this DHTML script lets you display external web pages inline on your page, with the help of the IFRAME tag. We threw in a feature that allows the user to also load the webpage in the entire browser window when desired. This script works in IE5+ and NS6+, and degrades well with the rest (as tabs are simply regular links). Cool!
Step 1: Add the below CSS and DHTML script to the <HEAD> section of your page:
<style type="text/css">
/*Eric Meyer's based CSS tab*/
#tablist{
padding: 3px 0;
margin-left: 0;
margin-bottom: 0;
margin-top: 0.1em;
font: bold 12px Verdana;
}
#tablist li{
list-style: none;
display: inline;
margin: 0;
}
#tablist li a{
text-decoration: none;
padding: 3px 0.5em;
margin-left: 3px;
border: 1px solid #778;
border-bottom: none;
background: white;
}
#tablist li a:link, #tablist li a:visited{
color: navy;
}
#tablist li a:hover{
color: #000000;
background: #C1C1FF;
border-color: #227;
}
#tablist li a.current{
background: lightyellow;
}
</style>
<script type="text/javascript">
/***********************************************
* Tabbed Document Viewer script- ? Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var selectedtablink=""
var tcischecked=false
function handlelink(aobject){
selectedtablink=aobject.href
tcischecked=(document.tabcontrol && document.tabcontrol.tabcheck.checked)? true : false
if (document.getElementById && !tcischecked){
var tabobj=document.getElementById("tablist")
var tabobjlinks=tabobj.getElementsByTagName("A")
for (i=0; i<tabobjlinks.length; i++)
tabobjlinks[i].className=""
aobject.className="current"
document.getElementById("tabiframe").src=selectedtablink
return false
}
else
return true
}
function handleview(){
tcischecked=document.tabcontrol.tabcheck.checked
if (document.getElementById && tcischecked){
if (selectedtablink!="")
window.location=selectedtablink
}
}
</script>
Step 2: Add the below code to the <BODY> section of your page:
<ul id="tablist">
<li><a class="current" >Google</a></li>
<li><a >Yahoo</a></li>
<li><a >MSN</a></li>
<li><a >News.com</a></li>
<li><a >Dynamic Drive</a></li>
</ul>
<iframe id="tabiframe" src="http://www.google.com" width="98%" height="350px"></iframe>
<form name="tabcontrol" style="margin-top:0">
<input name="tabcheck" type="checkbox" onClick="handleview()"> Open tab links in browser window instead.
</form>
<ul id="tablist">
<li><a class="current" href="#">Google</a></li>
<li><a href="#">Yahoo</a></li>
<li><a href="#">MSN</a></li>
<div style="margin-bottom: 8px"></div>
<li><a href="#">News.com</a></li>
<li><a href="#">Dynamic Drive</a></li>
</ul>
相關(guān)文章
js parentElement和offsetParent之間的區(qū)別
這里主要說(shuō)的是 offsetParent 屬性,這個(gè)屬性在 MSDN 的文檔中也沒(méi)有解釋清楚,這就讓人更難理解這個(gè)屬性。 這幾天在網(wǎng)上找了些資料看看,再加上自己的一些測(cè)試,對(duì)此屬性有了那么一點(diǎn)的了解,在這里總結(jié)一下。2010-03-03JS正則表達(dá)式學(xué)習(xí)之貪婪和非貪婪模式實(shí)例總結(jié)
這篇文章主要介紹了JS正則表達(dá)式學(xué)習(xí)之貪婪和非貪婪模式用法,結(jié)合實(shí)例形式總結(jié)分析了JS正則表達(dá)式中貪婪模式與非貪婪模式的具體功能、使用方法與相關(guān)注意事項(xiàng),需要的朋友可以參考下2016-12-12JS實(shí)現(xiàn)數(shù)組/對(duì)象數(shù)組刪除其中某一項(xiàng)
這篇文章主要介紹了JS實(shí)現(xiàn)數(shù)組/對(duì)象數(shù)組刪除其中某一項(xiàng),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-09-09詳解JavaScript中js對(duì)象與JSON格式字符串的相互轉(zhuǎn)換
本篇文章主要介紹了JavaScript中js對(duì)象與JSON格式字符串的相互轉(zhuǎn)換,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。2017-02-02微信小程序 Animation實(shí)現(xiàn)圖片旋轉(zhuǎn)動(dòng)畫(huà)示例
這篇文章主要介紹了微信小程序 Animation實(shí)現(xiàn)圖片旋轉(zhuǎn)動(dòng)畫(huà)示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-08-08原生javascript實(shí)現(xiàn)分享到朋友圈功能 支持ios和android
本文主要介紹網(wǎng)上一個(gè)牛人寫(xiě)的js可以實(shí)現(xiàn)在UC瀏覽器和QQ瀏覽器中調(diào)用瀏覽器內(nèi)置的分享組件進(jìn)行分享。2016-05-05