zoukankan
html css js c++ java
页面终止程序PromptHelper.cs
using
System.Text;
using
System.Web;
namespace
HiDr_02.Helpers
{
/**/
///
<summary>
///
程序终止类
///
</summary>
public
class
PromptHelper
{
Response.Write private void Echo(string s)
#region
Response.Write private void Echo(string s)
private
static
void
Echo(
string
s)
{
HttpContext.Current.Response.Write(s);
}
#endregion
end private void End()
#region
end private void End()
/**/
///
<summary>
///
end
///
</summary>
private
static
void
End()
{
HttpContext.Current.Response.End();
}
#endregion
alert javascript
#region
alert javascript
/**/
///
<summary>
///
alert javascript
///
</summary>
///
<param name="s"></param>
public
static
void
Alert(
string
s)
{
Echo(
"
<script language='javascript'>alert('
"
+
s.Replace(
"
'
"
,
@"
\'
"
)
+
"
');history.back();</script>
"
);
End();
}
public
static
void
Alert(
string
s,
string
backurl)
{
Echo(
"
<script language='javascript'>alert('
"
+
s.Replace(
"
'
"
,
@"
\'
"
)
+
"
');location.href='
"
+
backurl
+
"
';</script>
"
);
End();
}
#endregion
stop public virtual void Throw(string message)
#region
stop public virtual void Throw(string message)
/**/
///
<summary>
///
stop
///
</summary>
///
<param name="message"></param>
public
static
void
Throw(
string
message)
{
HttpContext.Current.Response.ContentType
=
"
text/html
"
;
HttpContext.Current.Response.AddHeader(
"
Content-Type
"
,
"
text/html
"
);
Throw(message,
null
,
null
,
null
,
true
);
}
#endregion
输出指定的提示信息 public virtual void Throw(string message, string title, string links, string autojump, bool showback)
#region
输出指定的提示信息 public virtual void Throw(string message, string title, string links, string autojump, bool showback)
/**/
///
<summary>
///
输出指定的提示信息
///
</summary>
///
<param name="message">
提示内容
</param>
///
<param name="title">
标题
</param>
///
<param name="links">
链拉
</param>
///
<param name="autojump">
自动跳转定向地址
</param>
///
<param name="showback">
是否显示返回链接
</param>
public
static
void
Throw(
string
message,
string
title,
string
links,
string
autojump,
bool
showback)
{
HttpContext.Current.Response.ContentType
=
"
text/html
"
;
HttpContext.Current.Response.AddHeader(
"
Content-Type
"
,
"
text/html
"
);
StringBuilder sb
=
new
StringBuilder(template);
sb.Replace(
"
{$Message}
"
, message);
sb.Replace(
"
{$Title}
"
, (title
==
null
||
title
==
""
)
?
"
系统提示
"
: title);
if
(links
!=
null
&&
links
!=
""
)
{
string
[] arr1
=
links.Split(
'
|
'
);
for
(
int
i
=
0
; i
<
arr1.Length; i
++
)
{
string
[] arr2
=
arr1[i].Split(
'
,
'
);
if
(arr2.Length
>
1
)
{
if
(arr2[
1
].Trim()
==
"
RefHref
"
)
{
arr2[
1
]
=
FetchHelper.Referrer;
}
if
(arr2[
1
]
==
string
.Empty
||
arr2[
1
]
==
null
)
{
continue
;
}
string
s
=
(
"
<li><a href='
"
+
arr2[
1
]
+
"
'
"
);
if
(arr2.Length
==
3
)
{
s
+=
(
"
target='
"
+
arr2[
2
].Trim()
+
"
'
"
);
}
if
(arr2[
0
].Trim()
==
"
RefText
"
)
{
arr2[
0
]
=
FetchHelper.Referrer;
}
s
+=
(
"
>
"
+
arr2[
0
].Trim()
+
"
</a></li>\r\n\t\t\t\t
"
);
sb.Replace(
"
{$Links}
"
, s
+
"
{$Links}
"
);
}
}
}
if
(autojump
!=
null
&&
autojump
!=
string
.Empty)
{
string
s
=
autojump
==
"
back
"
?
"
javascript:history.back()
"
: autojump;
sb.Replace(
"
{$AutoJump}
"
,
"
<meta http-equiv='refresh' content='3; url=
"
+
s
+
"
' />
"
);
}
else
{
sb.Replace(
"
{$AutoJump}
"
,
"
<!-- no jump -->
"
);
}
if
(showback)
{
sb.Replace(
"
{$Links}
"
,
"
<li><a href='javascript:history.back()'>返回前一页</a></li>
"
);
}
else
{
sb.Replace(
"
{$Links}
"
,
"
<!-- no back -->
"
);
}
Echo(sb.ToString());
End();
}
#endregion
//
------- template -------------------------------------------------------
页面终止页面模板 public virtual string template
#region
页面终止页面模板 public virtual string template
/**/
///
<summary>
///
页面终止页面模板
///
</summary>
private
static
string
template
{
get
{
return
@"
<html xmlns:v>
<head>
<title>{$Title}</title>
<meta http-equiv='Content-Type' content='text/html; charset=
"
+
Encoding.Default.BodyName
+
@"
' />
<meta name='description' content='.NET类库 页面中止程序' />
<meta name='copyright' content='http://www.hidr.cn/' />
<meta name='generator' content='vs2005' />
<meta name='usefor' content='application termination' />
{$AutoJump}
<style rel='stylesheet'>
v\:* {
behavior:url(#default#vml);
}
body, div, span, li, td, a {
color: #222222;
font-size: 12px !important;
font-size: 11px;
font-family: tahoma, arial, 'courier new', verdana, sans-serif;
line-height: 19px;
}
a {
color: #2c78c5;
text-decoration: none;
}
a:hover {
color: red;
text-decoration: none;
}
</style>
</head>
<body style='text-align:center;margin:90px 20px 50px 20px'>
<?xml:namespace prefix='v' />
<div style='margin:auto; 450px; text-align:center'>
<v:roundrect style='text-align:left; display:table; margin:auto; padding:15px; 450px; height:210px; overflow:hidden; position:relative;' arcsize='3200f' coordsize='21600,21600' fillcolor='#fdfdfd' strokecolor='#e6e6e6' strokeweight='1px'>
<table width='100%' cellpadding='0' cellspacing='0' border='0' style='padding-bottom:6px; border-bottom:1px #cccccc solid'>
<tr>
<td><b>{$Title}</b></td>
<td align='right' style='color:#f8f8f8'>--- Dvbbs terminator</td>
</tr>
</table>
<table width='100%' cellpadding='0' cellspacing='0' border='0' style='word-break:break-all; overflow:hidden'>
<tr>
<td width='80' valign='top' style='padding-top:13px'><span style='font-size:16px; zoom:4; color:#aaaaaa'><font face='webdings'>i</font></span></td>
<td valign='top' style='padding-top:17px'>
<p style='margin-bottom:22px'>{$Message}</p>
{$Links}
</td>
</tr>
</table>
</v:roundrect>
</div>
</body>
</html>
"
;
}
}
#endregion
}
}
查看全文
相关阅读:
ListView添加HeaderView的顺序问题
shape与selector配合使用实现Tab下划线效果
在java代码中设置TextView的字体大小,单位设为sp
一个textView中的文字设置成两种颜色
Android studio生成类图
linux常用命令总结
主机CPU与显卡选择
电脑与显示器四种接口
Linux shell
Linux 常用命令二
原文地址:https://www.cnblogs.com/zq535228/p/1023861.html
最新文章
jQuery中attr和prop的区别【转】
express4学习文档
不错的H5效果
输入网址到出现页面的过程
在线学习平台
Android实现Excel表格,且表格能左右、上下滑动
android网络编程之HttpUrlConnection的讲解--DownLoadManager基本用法
android网络编程之HttpUrlConnection的讲解--实现文件的断点上传
android网络编程之HttpUrlConnection的讲解--实现文件断点下载
android网络编程之HttpUrlConnection的讲解--上传大文件
热门文章
android网络编程之HttpUrlConnection的讲解--POST请求
android网络编程之HttpUrlConnection的讲解--GET请求
android网络开发之测试机连接到服务器上面
Android Studio的使用(十四)--如何查看资源或者函数在哪些类中被引用
Android数据库--Sqlcipher的使用(二)
double类型计算
JAVA国际化问题
循环播放一张图片,如果图片大小小于屏幕,继续使用该图片进行填充
RelativeLayout布局,不希望文本盖住其他组件
Button样式问题浅谈
Copyright © 2011-2022 走看看