帝国软件
  设为首页 加入收藏 关于我们
 
解密帝国网站管理系统
栏 目:
 
您的位置:首页 > 技术文档 > ASP编程
使用<meta>标签的ASP源程序例子
作者: 发布时间:2005-03-12 来源:
utils/Init.asp
<%
// ============================================
// NOTE: all source code downloaded from CoverYourASP was written by
// James Shaw (unless stated otherwise), and is copyright (c) 2000 by
// James Shaw. You may use this source code on your web sites, but
// please don't publish or distribute in any way.
//
// I would appreciate an HTML comment in any code you use, i.e.
//         <!-- portions (c) james@CoverYourASP.com-->
// (see Footer(), documented in SSI.asp for details on how to do this)
//
// <shameless plug>
//      Please contact me to discuss any ASP contract work you may have.
// </shameless plug>
// ============================================

// ============================================
// the standard meta tags to start document
// ============================================
function Init ( sTitle, sKeywords )
{
   Out ( '<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-
html40/loose.dtd">' );
   Out ( '<html><head>' );
   Out ( '<base target="_top">' );

   // for any browsers
   Out ( '<link rev=MADE href="mailto:james@CoverYourASP.com">' );
   Out ( '<meta name="resource-type" content="document">' );
   Out ( '<meta http-equiv="Content-Type" Content="text-html; charset=iso8859-1">' );
   Out ( '<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen
true comment "RSACi North America Server" for "http://CoverYourASP.com/" on "2000.09.08T03:03-0800" r (n 0
s 0 v 0 l 0))'>' );

   // for spiders only - I hide these lines from browsers
   var sBrowser = "" + Request.ServerVariables ( 'HTTP_USER_AGENT' );

   if ( ( -1 == sBrowser.indexOf ( 'Mozilla' ) && -1 == sBrowser.indexOf ( 'Opera' ) ) || IsDebug () )
   {
      // it's an unknown browser - probably a spider
      Out ( '<meta name="Author" content="James Shaw">' );
      Out ( '<meta name="Keywords" content="coveryourasp, cya, james shaw, asp, active server pages,
active, server, pages, scripts, microsoft, iis, email, cdonts, form, access, database, free code, source,
code, programmer, programming, developer, development, javascript, jscript, com, atl, c++' );
      // add any passed-in keywords
      if ( sKeywords != undefined )
         Out ( ', ' + sKeywords );
      Out ( '"><meta name="Description" content="Live examples and full source code for solving practical
problems using ASP (Active Server Pages), C++ ATL COM components, Server and Client-side JavaScript and
DHTML.">' );
   }
   else
   {
      // it's a known browser - show "throwaway" keywords so we don't arouse suspicion!
      Out ( '<meta name="Keywords" content="James Shaw">' );
      Out ( '<meta name="Description" content="James Shaw's site">' );
   }

   Out ( '<title>' + sTitle + '</title>' );

   Out ( '<style>' );
      Out ( 'a:link { color:#FF3300; }' );
      Out ( 'a:vlink { color:#FF3300; }' );
      Out ( 'a:alink { color:#CC0000; }' );
      Out ( 'body { font:8pt/11pt verdana;}' );
      Out ( 'table { font:8pt/11pt verdana;}' );
   Out ( '</style></head>' );
}

// ============================================
// are we being run from a special debug URL?
// ============================================
var bDebug;

function IsDebug ( )
{
   // for efficiency, only work out if we're in debug mode
   // the first time we're used on a page.
   if ( bDebug == undefined )
   {
      // the test can be if we're on localhost (i.e. on development machine)
      /*
      var sServer = "" + Request.ServerVariables ( "SERVER_NAME" );

      bDebug = ( -1 != sServer.indexOf ( "localhost" ) );
      */

      //..or for demo purposes, if a certain QueryString exists
      bDebug = ( 0 != Request.QueryString ( "debug" ).Count );
   }

   return bDebug;
}

// ============================================
// shorthand to save me typing Response.Write all the time!
// ============================================
function Out ( sHTML )
{
   Response.Write ( sHTML );
}

// ============================================
// only display when special URL
// ============================================
function DebugOut ( sHTML )
{
   if ( !IsDebug () )
      return;

   Out ( sHTML );
}
%>
  
评论】【加入收藏夹】【 】【打印】【关闭
※ 相关链接
 ·在ASP中使用Ad Rotator广告组件  (2005-03-12)
 ·Ad Rotator组件使用例子  (2005-03-12)
 ·ASP中FSO的神奇功能 - 使用FSO进  (2005-03-12)
 ·错误“操作必须使用一个可更新的  (2005-03-12)
 ·asp使用activex组件实例一  (2005-03-12)
 ·使用asp+中的若干问题及解决方案  (2005-03-12)
 ·使用ASP重启服务器  (2005-03-12)
 ·在ASP+中使用Cookie  (2005-03-12)
 ·如何使用asp创建dsn  (2005-03-12)
 ·在ASP中使用类  (2005-03-12)

   栏目导行
  PHP编程
  ASP编程
  ASP.NET编程
  JAVA编程
   站点最新
·致合作伙伴的欢迎信
·媒体报道
·帝国软件合作伙伴计划协议
·DiscuzX2.5会员整合通行证发布
·帝国CMS 7.0版本功能建议收集
·帝国网站管理系统2012年授权购买说
·PHPWind8.7会员整合通行证发布
·[官方插件]帝国CMS-访问统计插件
·[官方插件]帝国CMS-sitemap插件
·[官方插件]帝国CMS内容页评论AJAX分
   类别最新
·在ASP中使用数据库
·使用ASP脚本技术
·通过启动脚本来感受ASP的力量
·学习使用ASP对象和组件
·解析asp的脚本语言
·初看ASP-针对初学者
·ASP开发10条经验总结
·ASP之对象总结
·ASP与数据库应用(给初学者)
·关于学习ASP和编程的28个观点
 
关于帝国 | 广告服务 | 联系我们 | 程序开发 | 网站地图 | 留言板 帝国网站管理系统