ASP.NET JS常用方法类
	
    
    
	using System.Web; 
/// <summary> 
/// Javascript常用方法 
/// </summary> 
public class JS 
{ 
    private static string ScriptStart = "<script type=\"text/javascript\">"; 
    private static string ScriptEnd = "</script>"; 
    /// <summary> 
    /// 写入JS脚本内容 
    /// </summary> 
    /// <param name="ScriptString">脚本内容</param> 
    /// <param name="IsResponseEnd">是否中断服务端脚本执行</param> 
    public static void WriteScript(string ScriptString, bool IsResponseEnd) 
    { 
        HttpContext.Current.Response.Write(ScriptStart); 
        HttpContext.Current.Response.Write(ScriptString); 
        HttpContext.Current.Response.Write(ScriptEnd); 
        if (IsResponseEnd) 
        { 
            HttpContext.Current.Response.End(); 
        } 
    } 
   /// <summary> 
   /// 弹出警告框 
   /// </summary> 
   /// <param name="AlertMessage">提示信息</param> 
   /// <param name="IsResponseEnd">是否中断服务端脚本执行</param> 
    public static void Alert(string AlertMessage, bool IsResponseEnd) 
    { 
        HttpContext.Current.Response.Write(ScriptStart); 
        HttpContext.Current.Response.Write("alert('" + AlertMessage + "');history.back();"); 
        HttpContext.Current.Response.Write(ScriptEnd); 
      &nb
    
     
	
	
    
    
	相关文档:
        
    
    通常javascript代码可以与HTML标签一起直接放在前端页面中,但如果JS代码多的话一方面不利于维护,另一方面也对搜索引擎不友好,因
为页面因此而变得臃肿;所以一般有良好开发习惯的程序员都会把javascript代码放到独立的js文件中,其他页面通过引入该js文件来使用相应的
javascript代码。
今天在做一个小新闻系统的管理 ......
	
    
        
    
    分页代码如下(PageHelper.cs):
代码 
  1 using System;
  2 using System.Collections.Generic;
  3 using System.Collections.Specialized;
  4 using System.Linq;
  5 using System.Web;
   ......
	
    
        
    
    一、ASP.NET Web Service代码
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data.SqlClient;
 
namespace WebService1
{
    /// <sum ......
	
    
        
    
    using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.ComponentModel;
namespace SQLHelper
{
 /// <summary>
 /// Class1 的摘要说明。
 /// </summary>
 public class SQLHelper
 {
  // 连接数据源
 ......