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

2016-02-19 10:02 2 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 

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

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

延伸阅读
响应网页设计目前在网页设计中无疑是一个热门话题。从某种程度上来说,响应网页设计概念的普及是非常应该的,因为用户以越来越多样化的方式访问网站。iPad,iPhone,Android移动设备,桌面,笔记本现在我们的网页设计必须在众多方式下使用。 让我们来了解响应网页设计的含意和原则。 响应网页设计的关键特征 认为网页设计是响应的,需要...
标签: Web开发
网页是通过视觉元素的引人注目而实现信息内容的传达,为了使网页获得最大的视觉传达功能,使网络真正成为可读强性而且新颖的媒体,网页的设计必须适应人们视觉流向的心理和生理的特点,由此确定各种视觉构成元素之间的关系和秩序。因此,设计时应该研究各种视觉造型元素之间的距离、位置、面积和视觉流程的问题。 视觉流程的形成是由...
标签: Web开发
在符合标准的网页设计中如何用CSS控制网页的背景呢?包括背景的颜色,背景的图片等一些问题,在本教程中一次给你讲清楚。 ·背景颜色 background-color 我想这个我就不用多做介绍了,颜色代码我想大家都知道的,不是用英文来代替就是用指定的代码来表示的。这个的默认值是transparent(透明色)。 例:body{background-co...
图片,是构成网页的基本元素之一。图片不仅能够增加网页的吸引力,传达给用户更加丰富的信息,同时也大大地提升了用户在浏览网页的体验。图片的展示形式丰富多样,不同形式的图片展现也让浏览网页的乐趣变得更加多样化。 跟随我们分别来体验一下目前存在的各种图片展现形式,让我们的眼睛去旅行吧。 一、多图展现 图片限制最大高度或...
随着互联网的发展,人们开始越来越多使用WEB表单,虽然没有人愿意填写这东西,但却无法忽视其对于网站的重要性,特别是购物网站,随着网站类型的扩展,WEB表单的形式也变得越多越多,这也就成了今天讨论的主题,如何设计出令用户满意的WEB表单!随着文中一起来分享一下国外一些优秀的WEB表单是如何设计的。 随着网络的发展,人们通过各种方式使...

经验教程

879

收藏

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