String
str
=
Server.MapPath(
"
文件名
"
); 在项目下建文件,
StreamWriter sw = new StreamWriter(str);
sw.Write( " woaizhutingting " );
sw.Close();
用户名: var pattern = /^ [a - zA - Z]([\u4E00 - \u9FA5] | [\uFE30 - \uFFA0] | [_\a - zA - Z0 - 9 ] | [\s]) * $ / gi;
< a href = " http://www.baidu.com " onclick = " this.href='#';doaction() " > 只产生点击事件 </ a >
sDir不存在时,创建它
if ( ! Directory.Exists(sDir))
{
Directory.CreateDirectory(sDir);
}
跳转并跳出框架
Page.RegisterStartupScript( " d " , " <script>window.open('index.aspx','_parent')</script> " );
// 禁止鼠标粘贴和键盘输入
onselectstart = " return false " onkeydown = " return false "
随即数
< script >
var i = Math.random() * 1
alert(i)
</ script >
// 给table添加一行。(限IE)
with(tbTripInfo.firstChild)appendChild(lastChild.cloneNode( true ));
设置文字与框并排显示。
< asp:RadioButtonList id = " RadioButtonList1 "
RepeatDirection = " Horizontal "
RepeatLayout = " Table "
runat = " server " >
< asp:ListItem > 文字 </ asp:ListItem >
// 提交时屏蔽按钮
< script type = " text/javascript " >
function chk(frm) {
frm.Button1.disabled = true ;
frm.Button1.value = ' 提交... ' ;
}
</ script >
< asp:Button ID = " Button1 " UseSubmitBehavior = " false " runat = " server " OnClientClick = " chk(form1) "
OnClick = " Button1_Click " Text = " 提交 " />
// 使用ajax与框架时注意:
在使用框架指定frameborder时,不能指定yes和no,只能指定1和0.错误信息为;Sys.ArgumentOutOfRangeException: Value must be an integer
设置上传文件大小
< system.web >
< httpRuntime maxRequestLength = " 8192 " // 可变更
useFullyQualifiedRedirectUrl = " true "
executionTimeout = " 45 "
versionHeader = " 1.1.4128 " />
</ system.web >
using System.Diagnostics ;
Process.Start ( @" shutdown " , @" -s -t 10 " );列个是10秒钟自动关机
md5加密
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, " md5 " )
// 字体转换
添加Microsoft Visual Basic.NET Runtime 引用
str2 = Microsoft.VisualBasic.Strings.StrConv(str1, Microsoft.VisualBasic.VbStrConv.TraditionalChinese, System.Globalization.CultureInfo.CurrentCulture.LCID);
str3 = Microsoft.VisualBasic.Strings.StrConv(str1, Microsoft.VisualBasic.VbStrConv.SimplifiedChinese, System.Globalization.CultureInfo.CurrentCulture.LCID);
// 关闭窗体时不提示
Response.Write( " <script>window.opener=null;window.close()</script> " )
如果是通过子窗体关闭父窗体时怎么做呢
子窗体(弹出窗体):
同理可得:
Response.Write( " <script>window.opener.top.opener=null;window.opener.top.close()</script> " )
加html内容(insertAdjacentHTML和insertAdjacentText)
dhtml提供了两个方法来进行添加,insertAdjacentHTML和insertAdjacentText
insertAdjacentHTML方法:在指定的地方插入html标签语句。
原型:insertAdjacentHTML(swhere,stext)
参数:
swhere:指定插入html标签语句的地方,有四种值可以用:
1 .beforeBegin:插入到标签开始前
2 .afterBegin:插入到标签开始标记后
3 .beforeEnd:插入到标签结束标记前
4 .afterEnd:插入到标签结束标记后
StreamWriter sw = new StreamWriter(str);
sw.Write( " woaizhutingting " );
sw.Close();
用户名: var pattern = /^ [a - zA - Z]([\u4E00 - \u9FA5] | [\uFE30 - \uFFA0] | [_\a - zA - Z0 - 9 ] | [\s]) * $ / gi;
< a href = " http://www.baidu.com " onclick = " this.href='#';doaction() " > 只产生点击事件 </ a >
sDir不存在时,创建它
if ( ! Directory.Exists(sDir))
{
Directory.CreateDirectory(sDir);
}
跳转并跳出框架
Page.RegisterStartupScript( " d " , " <script>window.open('index.aspx','_parent')</script> " );
// 禁止鼠标粘贴和键盘输入
onselectstart = " return false " onkeydown = " return false "
随即数
< script >
var i = Math.random() * 1
alert(i)
</ script >
// 给table添加一行。(限IE)
with(tbTripInfo.firstChild)appendChild(lastChild.cloneNode( true ));
设置文字与框并排显示。
< asp:RadioButtonList id = " RadioButtonList1 "
RepeatDirection = " Horizontal "
RepeatLayout = " Table "
runat = " server " >
< asp:ListItem > 文字 </ asp:ListItem >
// 提交时屏蔽按钮
< script type = " text/javascript " >
function chk(frm) {
frm.Button1.disabled = true ;
frm.Button1.value = ' 提交... ' ;
}
</ script >
< asp:Button ID = " Button1 " UseSubmitBehavior = " false " runat = " server " OnClientClick = " chk(form1) "
OnClick = " Button1_Click " Text = " 提交 " />
// 使用ajax与框架时注意:
在使用框架指定frameborder时,不能指定yes和no,只能指定1和0.错误信息为;Sys.ArgumentOutOfRangeException: Value must be an integer
设置上传文件大小
< system.web >
< httpRuntime maxRequestLength = " 8192 " // 可变更
useFullyQualifiedRedirectUrl = " true "
executionTimeout = " 45 "
versionHeader = " 1.1.4128 " />
</ system.web >
using System.Diagnostics ;
Process.Start ( @" shutdown " , @" -s -t 10 " );列个是10秒钟自动关机
md5加密
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, " md5 " )
// 字体转换
添加Microsoft Visual Basic.NET Runtime 引用
str2 = Microsoft.VisualBasic.Strings.StrConv(str1, Microsoft.VisualBasic.VbStrConv.TraditionalChinese, System.Globalization.CultureInfo.CurrentCulture.LCID);
str3 = Microsoft.VisualBasic.Strings.StrConv(str1, Microsoft.VisualBasic.VbStrConv.SimplifiedChinese, System.Globalization.CultureInfo.CurrentCulture.LCID);
// 关闭窗体时不提示
Response.Write( " <script>window.opener=null;window.close()</script> " )
如果是通过子窗体关闭父窗体时怎么做呢
子窗体(弹出窗体):
同理可得:
Response.Write( " <script>window.opener.top.opener=null;window.opener.top.close()</script> " )
加html内容(insertAdjacentHTML和insertAdjacentText)
dhtml提供了两个方法来进行添加,insertAdjacentHTML和insertAdjacentText
insertAdjacentHTML方法:在指定的地方插入html标签语句。
原型:insertAdjacentHTML(swhere,stext)
参数:
swhere:指定插入html标签语句的地方,有四种值可以用:
1 .beforeBegin:插入到标签开始前
2 .afterBegin:插入到标签开始标记后
3 .beforeEnd:插入到标签结束标记前
4 .afterEnd:插入到标签结束标记后