代码片断3

 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:插入到标签结束标记后
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值