在你的网页中嵌入外部网页的方法

2016-02-19 10:02 7 1 收藏

今天图老师小编给大家展示的是在你的网页中嵌入外部网页的方法,精心挑选的内容希望大家多多支持、多多分享,喜欢就赶紧get哦!

【 tulaoshi.com - Web开发 】

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; itabobjlinks.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 
To customize the look of the tabs (ie: color), edit the CSS. There is no need to modify the script at all.
Step 2: Add the below code to the BODY section of your page:
代码如下:

ul id="tablist" 
lia class="current" href="http://www.google.com" onClick="return handlelink(this)"Google/a/li 
lia href="http://www.yahoo.com" onClick="return handlelink(this)"Yahoo/a/li 
lia href="http://www.msn.com" onClick="return handlelink(this)"MSN/a/li 
lia href="http://www.news.com" onClick="return handlelink(this)"News.com/a/li 
lia href="http://www.dynamicdrive.com" onClick="return handlelink(this)"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 
The above HTML code renders the tab links and IFRAME tag used to contain the external documents. Change the URLs to your own. Now, if you have lots of tab links, you can get them to appear on separate lines, by adding a divider: 代码如下:

ul id="tablist" 
lia class="current" href="#"Google/a/li 
lia href="#"Yahoo/a/li 
lia href="#"MSN/a/li 
div style="margin-bottom: 8px"/div 
lia href="#"News.com/a/li 
lia href="#"Dynamic Drive/a/li 
/ul 

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/webkaifa/)

来源:http://www.tulaoshi.com/n/20160219/1593106.html

延伸阅读
  1、给主页添加视频动画 只要把下面这段代码添加到你的网页中,就可以在主页中添加Windows视频动画或其他RralMedia格式的视频动画。 <img dynsrc="http://img.jcwcn.com/attachment/portal"fileopen" width="360" height="190" alt="test.avi (40M字节)" controls hspace="-1" vspace="0" 在这段代码中,dynsrc的值为你的动画文...
标签: 网页设计 设计
留白 日本的设计有一个最大的特点就是极简,极简意味着留白。留白,也可以称为负空间。留白并非只是简单的指白色空间部分,它也可能是同个网页下的各个元素的空白空间。 这样的留白可以体现在多个地方,比如:幻灯片、区块边距、布局、行距、图表等。处理留白比较考验设计师的设计能力,留白可以打造简约的风格特点,而在哪里留白就...
  一般在站点制作中,总难免需要在网页中输入联系的Email。但不知,这样就给那些所谓的网络商家有机可乘,他们会使用软件或者程序进行搜索,然后将你的Email地址放入他们的联系库中,以后就会无休无止的垃圾邮件“光临”你的邮箱,实在让人头痛,Juven也痛苦不堪呀。 这次我们来介绍一种方法,就是使用javascript制作的,并不影响你...
标签: 网页设计 设计
抓人眼球的首图 横跨屏幕的轮播首图是时下流行的网页设计手法,设计师通过覆盖视野式的图片来营造身临其境的体验,这非常符合人类视觉优先的信息获取方式,所以,漂亮的首图是抓住用户注意力的重要手段。优质的首图能够让用户明白,他们可以从这个网站获取一些什么。 色彩叠加 这里说的色彩叠加值得是用半透明的色彩图层叠加在图...
标签: 浏览器
Firefox如何保存网页中的Flash   Firefox保存网页中的Flash方法。 ①点击工具 - 页面信息 - 媒体,或者在网页中点击右键 - 页面信息 - 媒体,找到想保存的Flash,再点击另存即可。 ②如果有安装Adblock,可以打开Adblock的Obj-Tabs选项来查看Flash的地址,再用flashget之类的下载软件来下载Flash。 ③安装扩展 Dow...

经验教程

526

收藏

82
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部