ASP学习笔记(12)--Include
来源:互联网 发布:淘宝卡马甲是什么意思 编辑:程序博客网 时间:2024/05/29 13:38
写过javascript的人都知道javascript有一个很有用的个性,引用某些程序段,格式如下<script language="javascript" src="md5.js"> 但是在asp中我们不能如此引用一个函数,必须使用SSI (server side include),格式如下<!--#include file="fortest17.asp"-->。跟所有编程语言的包含语句一样,我们只需要有一个这样的备份,然后就可以在不同的页面使用其中的函数以及数据了。
<%@ language=javascript %>
<!-- #include file="fortest17.asp" -->
<html>
<head>
<title><%Response.Write(whattime())%></title>
</head>
<body>
<%
Response.Write("the date and time is "+DateTime+"<br>/r");
%>
</body>
</html>
fortest17.asp
<%
function whattime(){
var todayTime=new Date();
var theHour=todayTime.getHours();
var theMinute=todayTime.getMinutes();
var theSecond=todayTime.getSeconds();
if(theHour>=0 && theHour<10){
theHour="0"+theHour;
}
if(theMinute>=0 && theMinute<10){
theMinute="0"+theMinute;
}
if(theSecond>=0 && theSecond<10){
theSecond="0"+theSecond;
}
var theTime=theHour+":"+theMinute+":"+theSecond;
return theTime;
}
var todayDate=new Date();
var theYear=todayDate.getYear();
var theMonth=todayDate.getMonth()+1;
var theDate=todayDate.getDate();
var theDate=theYear+"/"+theMonth+"/"+theDate;
var DateTime=theDate+" "+whattime();
%>
记得哦,在fortest17.asp中不能包含<%@ language=javascript %>的,否则会报错。其实道理也很显然,fortest17.asp就是test17.asp的一部分,其实两个文件可以写到一起的。include的好处就在于别的页面也可以使用这个fortest17.asp。
- ASP学习笔记(12)--Include
- 学习asp笔记(1)-0920
- 学习笔记-#include <windows.h>
- [笔记]c++学习之include
- ASP学习笔记(8)--Request对象相关
- ASP学习笔记(10)--Application对象
- ASP学习笔记(11)--Session对象
- ASP学习笔记(13)--Server对象
- ASP学习笔记(14)--Connection对象
- ASP学习笔记(15)--Recordset对象
- Android学习笔记(十六):include标签的使用
- asp include
- 学习asp笔记(2)
- ASP学习笔记(一)
- ASP学习笔记(二)
- asp学习笔记(1)
- ASP学习笔记(一)
- 【web开发学习笔记】Structs2 Action学习笔记(四)include的使用
- 求助个存储过程的问题
- 网讯笔经
- 项目开发经验谈(一)
- php smtp邮件发送的标题乱码等一系列问题
- php一行一行读取文件_fgets函数
- ASP学习笔记(12)--Include
- 5.6
- php编写大型网站问题集
- php文件操作常用函数或方法
- Visual C++6.0 工程文件说明
- IHS虚拟主机SSL配置
- Visual C#常用函数和方法集汇总
- php文件操作,文件夹列表,文件列表
- ajax提交中文编码问题(同时给出几个js与php编码方式)