asp.net c# js·þÎñÆ÷¶Ë³£ÓÃ
using System;
using System.Web;
namespace pub.mo
{
public class js
{
private js() { }
private static string scr_j1 = "<mce:script type=\"text/javascript\"><!--
";
private static string scr_j2 = "
// --></mce:script>";
/// <summary>
/// ÊäÈëjs²¢Í£Ö¹ÔËÐÐ
/// </summary>
/// <param name="str"></param>
public static void write_js(string str)
{
HttpContext.Current.Response.Write(config.j1);
HttpContext.Current.Response.Write(scr_j1);
HttpContext.Current.Response.Write(str);
HttpContext.Current.Response.Write(scr_j2);
HttpContext.Current.Response.Write(config.j2);
HttpContext.Current.Response.End();
}
/// <summary>
/// ÊäÈëjs,ÎÞResponse.End()
/// </summary>
/// <param name="str"></param>
public static void write_js1(string str)
{
HttpContext.Current.Response.Write(config.j1);
HttpContext.Current.Response.Write(scr_j1);
HttpContext.Current.Response.Write(str);
HttpContext.Current.Response.Write(scr_j2);
HttpContext.Current.Response.Write(config.j2);
}
/// <summary>
/// µ¯³öÏûÏ¢¿ò µãÈ·¶¨ºóhistory.back();
/// </summary>
/// <param name="str"></param>
public static void alert(string str)
{
HttpContext.Current.Response.Write(config.j1);
HttpContext.Current.Response.Write(scr_j1);
HttpContext.Current.Response.Write("alert('" + str + "');history.back();");
HttpContext.Current.Response.Write(scr_j2);
HttpContext.Current.Response.Write(config.j2);
HttpContext.Current.Response.End();
}
/// <summary>
///
/// </sum
Ïà¹ØÎĵµ£º
1.ÈçºÎÔÚJavaScript·ÃÎÊC#º¯Êý?
·½·¨Ò»£º1¡¢Ê×ÏȽ¨Á¢Ò»¸ö°´Å¥£¬ÔÚºǫ́½«µ÷Óûò´¦ÀíµÄÄÚÈÝдÈëbutton_clickÖÐ;
2¡¢ÔÚǰ̨дһ¸öjsº¯Êý£¬ÄÚÈÝΪdocument.getElementById("btn1").click();
3¡¢ÔÚǰ̨»òºóÌ ......
using System.Text.RegularExpressions; //ÒýÈëµÄÃüÃû¿Õ¼ä
ÒÔÏÂΪÒýÓõÄÄÚÈÝ£º
//Çå³ýHTMLº¯Êý
public static string NoHTML(string Htmlstring)
{
//ɾ³ý½Å±¾
Htmlstr ......
´Ë´¦ÌṩµÄ´úÂëÓÃÀ´ÊµÏÖµ±asp.netÒ³ÃæÖеÄij¸öButton±»µã»÷ºódisableµô¸ÃÒ³ÃæÖÐËùÓеÄButton£¬´Ó¶ø·ÀÖ¹Ìá½»ÑÓʱµ¼ÖµĶà´ÎÌá½»¡£»ùÓÚ֮ǰµÄonceclickbutton½Å±¾.
//ASP.NETÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂë:javascript< script language="javascript"> < !-- function disableOtherSubmit()
{
var obj ......
Ö±½Ó·â×°³ÉÒ»¸öÀàµÄ£¬ÓÃÆðÀ´»¹Í¦·½±ãµÄ
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text ......