用怪异的眼光去研究
亮.net
博客园
首页
新随笔
新文章
联系
订阅
管理
posts - 24,comments - 60,trackbacks - 5
<
2007年8月
>
日
一
二
三
四
五
六
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
与我联系
发短消息
搜索
常用链接
我的随笔
我的空间
我的短信
我的评论
更多链接
我的参与
我的新闻
最新评论
我的标签
留言簿
(4)
给我留言
查看留言
我参与的团队
北京.NET俱乐部(0/1553)
ASP.NET AJAX (Atlas)学习(0/1352)
Windows Vista开发(0/237)
我的标签
iSCSI
(3)
存储
(3)
IET
(2)
配置
(2)
Linux
(2)
RHEL4
(1)
服务
(1)
安装
(1)
攻略
(1)
target
(1)
更多
随笔分类
.net FrameWork(11)
.net IL学习
.net 控件收集(2)
ASP.net(12)
ISCSI与存储技术(3)
Java Script 方面~(2)
Linux点滴(3)
Vista(2)
Windows Mobile
XML&Web Service
管理(1)
业内...(1)
运维与运营工作(1)
随笔档案
2008年7月 (1)
2008年3月 (3)
2007年11月 (2)
2007年8月 (3)
2007年5月 (2)
2007年4月 (3)
2007年2月 (2)
2007年1月 (1)
2006年11月 (2)
2006年10月 (2)
2006年9月 (1)
2006年8月 (1)
相册
昌黎黄金海岸
我的头像
吝蛋是美德
积分与排名
积分 - 15308
排名 - 2562
最新随笔
1. 生成短GUID的两个方法
2. ISCSI Enterprise Target 的其他资源和地址
3. RHEL 4 下 ISCSI Enterprise Target 的常用配置和常用操作
4. RedHat Enterprise 4 as4 ISCSI Target 网络存储服务器安装攻略
5. javascript 收集
6. 按键相关的 JS脚本代码
7. 对指定的网页进行截图 C#版
8. [无敌]一些web开发中常用的、做成cs文件的js代码 - 转帖来的
9. Google 巨强的代码搜索引擎静悄悄的推出?
10. 在Module中使用自定义过滤器,来统一对站内所有请求响应的输出内容进行采集或更改。
最新评论
阅读排行榜
1. 在Module中使用自定义过滤器,来统一对站内所有请求响应的输出内容进行采集或更改。(2728)
2. 在.net 中依据页的角色验证方式产生相匹配的菜单(2116)
3. Vista 下的注册 com 类失败解决方法(1146)
4. DotNetBar 6.6.0.4 for Vs2005 (+特殊补丁)(874)
5. AjaxPro.NET框架生成高效率的Tree(Asp.net 2.0)(示例代码下载) (669)
评论排行榜
1. 在Module中使用自定义过滤器,来统一对站内所有请求响应的输出内容进行采集或更改。(11)
2. Image 类使用中的奇怪问题及解决办法(9)
3. DotNetBar 6.6.0.4 for Vs2005 (+特殊补丁)(9)
4. 在.net 中依据页的角色验证方式产生相匹配的菜单(8)
5. 对指定的网页进行截图 C#版(8)
[无敌]一些web开发中常用的、做成cs文件的js代码 - 转帖来的
using
System;
using
System.Web;
using
System.Web.UI;
namespace
MyLib
{
/**/
/**/
/**/
///
<summary>
///
一些常用的Js调用
///
创建时间:2007-8-23
///
</summary>
public
class
Jscript
{
/**/
/**/
/**/
///
<summary>
///
弹出JavaScript小窗口
///
</summary>
///
<param name="js">
窗口信息
</param>
public
static
void
Alert(
string
message)
{
#region
string
js
=
@"
<Script language='JavaScript'>
alert('
"
+
message
+
"
');</Script>
"
;
HttpContext.Current.Response.Write(js);
#endregion
}
/**/
/**/
/**/
///
<summary>
///
弹出消息框并且转向到新的URL
///
</summary>
///
<param name="message">
消息内容
</param>
///
<param name="toURL">
连接地址
</param>
public
static
void
AlertAndRedirect(
string
message,
string
toURL)
{
#region
string
js
=
"
<script language=javascript>alert('{0}');window.location.replace('{1}')</script>
"
;
HttpContext.Current.Response.Write(
string
.Format(js, message, toURL));
#endregion
}
/**/
/**/
/**/
///
<summary>
///
回到历史页面
///
</summary>
///
<param name="value">
-1/1
</param>
public
static
void
GoHistory(
int
value)
{
#region
string
js
=
@"
<Script language='JavaScript'>
history.go({0});
</Script>
"
;
HttpContext.Current.Response.Write(
string
.Format(js, value));
#endregion
}
/**/
/**/
/**/
///
<summary>
///
关闭当前窗口
///
</summary>
public
static
void
CloseWindow()
{
#region
string
js
=
@"
<Script language='JavaScript'>
parent.opener=null;window.close();
</Script>
"
;
HttpContext.Current.Response.Write(js);
HttpContext.Current.Response.End();
#endregion
}
/**/
/**/
/**/
///
<summary>
///
刷新父窗口
///
</summary>
public
static
void
RefreshParent(
string
url)
{
#region
string
js
=
@"
<script>try{top.location=""
"
+
url
+
@"
""}catch(e){location=""
"
+
url
+
@"
""}</script>
"
;
HttpContext.Current.Response.Write(js);
#endregion
}
/**/
/**/
/**/
///
<summary>
///
刷新打开窗口
///
</summary>
public
static
void
RefreshOpener()
{
#region
string
js
=
@"
<Script language='JavaScript'>
opener.location.reload();
</Script>
"
;
HttpContext.Current.Response.Write(js);
#endregion
}
/**/
/**/
/**/
///
<summary>
///
打开指定大小的新窗体
///
</summary>
///
<param name="url">
地址
</param>
///
<param name="width">
宽
</param>
///
<param name="heigth">
高
</param>
///
<param name="top">
头位置
</param>
///
<param name="left">
左位置
</param>
public
static
void
OpenWebFormSize(
string
url,
int
width,
int
heigth,
int
top,
int
left)
{
#region
string
js
=
@"
<Script language='JavaScript'>window.open('
"
+
url
+
@"
','','height=
"
+
heigth
+
"
,width=
"
+
width
+
"
,top=
"
+
top
+
"
,left=
"
+
left
+
"
,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=no,toolbar=no,directories=no');</Script>
"
;
HttpContext.Current.Response.Write(js);
#endregion
}
/**/
/**/
/**/
///
<summary>
///
转向Url制定的页面
///
</summary>
///
<param name="url">
连接地址
</param>
public
static
void
JavaScriptLocationHref(
string
url)
{
#region
string
js
=
@"
<Script language='JavaScript'>
window.location.replace('{0}');
</Script>
"
;
js
=
string
.Format(js, url);
HttpContext.Current.Response.Write(js);
#endregion
}
/**/
/**/
/**/
///
<summary>
///
打开指定大小位置的模式对话框
///
</summary>
///
<param name="webFormUrl">
连接地址
</param>
///
<param name="width">
宽
</param>
///
<param name="height">
高
</param>
///
<param name="top">
距离上位置
</param>
///
<param name="left">
距离左位置
</param>
public
static
void
ShowModalDialogWindow(
string
webFormUrl,
int
width,
int
height,
int
top,
int
left)
{
#region
string
features
=
"
dialogWidth:
"
+
width.ToString()
+
"
px
"
+
"
;dialogHeight:
"
+
height.ToString()
+
"
px
"
+
"
;dialogLeft:
"
+
left.ToString()
+
"
px
"
+
"
;dialogTop:
"
+
top.ToString()
+
"
px
"
+
"
;center:yes;help=no;resizable:no;status:no;scroll=yes
"
;
ShowModalDialogWindow(webFormUrl, features);
#endregion
}
public
static
void
ShowModalDialogWindow(
string
webFormUrl,
string
features)
{
string
js
=
ShowModalDialogJavascript(webFormUrl, features);
HttpContext.Current.Response.Write(js);
}
public
static
string
ShowModalDialogJavascript(
string
webFormUrl,
string
features)
{
#region
string
js
=
@"
<script language=javascript>
showModalDialog('
"
+
webFormUrl
+
"
','','
"
+
features
+
"
');</script>
"
;
return
js;
#endregion
}
}
}
先看上面那个,如果你没有吐血再接着看:
using
System;
using
System.Web;
using
System.Web.UI;
namespace
MyLib
{
/**/
///
<summary>
///
一些常用的Js调用
///
</summary>
public
class
Jscript
{
/**/
///
<summary>
///
弹出JavaScript小窗口
///
</summary>
///
<param name="js">
窗口信息
</param>
public
static
void
Alert(
string
message)
{
#region
string
js
=
@"
<Script language='JavaScript'>
alert('
"
+
message
+
"
');</Script>
"
;
HttpContext.Current.Response.Write(js);
#endregion
}
/**/
///
<summary>
///
弹出消息框并且转向到新的URL
///
</summary>
///
<param name="message">
消息内容
</param>
///
<param name="toURL">
连接地址
</param>
public
static
void
AlertAndRedirect(
string
message,
string
toURL)
{
#region