请问html代码能否像脚本那样包含文件?

脚本可以这样

1<script language="javascript" src="kk.js"></script>

html代码能否这样?
thx

---------------------------------------------------------------

如果要用

1<script language="javascript" src="xx.js"></script>

,
那么xx.js必须用javascript来写html代码,如document.write("

1<html><body></body></html>

");

还可以用iframe来嵌入html
---------------------------------------------------------------

问题是你包含进来要干嘛??目的???
---------------------------------------------------------------

目的???
---------------------------------------------------------------

up
---------------------------------------------------------------

1.IFrame引入,看看下面的代码[代码]

1<iframe height="30" marginheight="0" marginwidth="0" name="content_frame" src="import.htm" width="100%"></iframe>

你会看到一个外部引入的文件,但会发现有一个类似外框的东西将其包围,可使用
[代码]

1<iframe frameborder="0" height="30" marginheight="0" marginwidth="0" name="content_frame" src="import.htm" width="100%"></iframe>

但你会发现还会有点问题,就是背景色不同,你只要在引入的文件import.htm中使用相同的背景色也可以,但如果你使用的是IE5.5的话,可以看看这篇关于透明色的文章 如果想引入的文件过长时不出现滚动条的话在import.htm中的body中加入scroll=no

 1<object>方式[代码] <object data="import.htm" height="30" style="border:0px" type="text/x-scriptlet" width="100%"></object>   
 2  
 33.Behavior的download方式[代码]   
 4<span id="showImport"></span>
 5<ie:download id="oDownload" style="behavior:url(#default#download)"></ie:download>
 6<script>   
 7function onDownloadDone(downDate){   
 8showImport.innerHTML=downDate   
 9}   
10oDownload.startDownload('import.htm',onDownloadDone)   
11</script>   
12\---------------------------------------------------------------   
13  
14include library   
15\---------------------------------------------------------------   
16  
17使用服务器端包含指令Server Side Include   
18比如<!--#include file="info.htm"-->   
19详细介绍看链接   
20http://www.alleasy.net/ssi-desc.htm   
21  
22\---------------------------------------------------------------   
23  
24这和CSS也没关系啊   
25\---------------------------------------------------------------   
26  
27使用服务器端包含指令Server Side Include   
28比如<!--#include file="info.htm"-->   
29这种方法要在服务器上才能测试,本机上不支持<!--#include file=""-->   
30\---------------------------------------------------------------   
31  
32有个办法,好象是将文件的扩展名改为.SHTML就可以了   
33  
34具体没有测试过。</object>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus