Username: Password:

使用<meta>标签的ASP源程式例子
来源:作者: 发布时间:2007-12-19 10:03:55

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.
//
// (see Footer(), documented in SSI.asp for details on how to do this)
//
//
// Please contact me to discuss any ASP contract work you may have.
//

// ============================================

// ============================================
// the standard meta tags to start document
// ============================================
function Init ( sTitle, sKeywords )
{
Out ( ’html40/loose.dtd">’ );
Out ( ’’ );
Out ( ’’ );

// for any browsers
Out ( ’’ );
Out ( ’’ );
Out ( ’’ );
Out ( ’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 ( ’’ );
Out ( ’’ );
}
else
{
// it’s a known browser - show "throwaway" keywords so we don’t arouse suspicion!
Out ( ’’ );
Out ( ’’ );
}

Out ( ’’ + sTitle + ’’ );

Out ( ’’ );
}

// ============================================
// 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 );
}
%>

喜欢本文,那就收藏到:

    Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网
相关评论  我也要评论
还没有关于此文章的相关评论!
  • 昵称: (为空则显示guest)
  • 评论分数: ★ ★ ★★★ ★★★★ ★★★★★
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
  • 导航
    赞助商
    文章类别
    订阅