Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascriptÔÚalert֮ǰתÒåµ¥ÒýºÅ

¶ÔÓÚ1¸öµ¥ÒýºÅ£¬ÔòתÒå¸Ãµ¥ÒýºÅ
¶ÔÓÚ1¸ö·´Ð±¸Ü¸ú1¸öµ¥ÒýºÅ£¬Ôò²»¹ÜËü¡£
¶ÔÓÚ2¸ö¼°ÒÔÉϵķ´Ð±¸Ü¼ÓÒ»¸öµ¥ÒýºÅ£¬Ôò·Ö±ð¶Ôÿ¸ö·´Ð±¸ÜºÍµ¥ÒýºÅ¶¼½øÐÐתÒ壬¼´ ʹ·´Ð±¸ÜÊýÄ¿±£³Ö²»±ä£¬ ²¢×ªÒåµ¥ÒýºÅ¡£
 

/// <summary>
/// ¶ÔÓÚµ¥ÒýºÅ¶øÑÔ£¬ÈôÇ°ÃæÓÐżÊý¸ö·´Ð±¸ÜÔòÒì³££¬ÆæÊý¸ö·´Ð±¸ÜÔòÕý³£
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
private string ReplaceQuote(string input)
{
string pattern = @"(?:\\)*(?=['])";
return Regex.Replace(input, pattern, new MatchEvaluator(ReplaceText));
}
// Æ¥ÅäÏî
public string ReplaceText(Match m)
{
string str = m.Value;
if (str.Length == 0)
{
// Ö»Óе¥ÒýºÅ£¬ÔòתÒå¸Ãµ¥ÒýºÅ
return str + @"\";
}
else if(str.Length == 1)
{
// 1¸ö·´Ð±¸Ü¼ÓÒ»¸öµ¥ÒýºÅ£¬Ôò²»Ìæ»»
return string.Empty;
}
// ¶ÔÓÚ´óÓÚ2¸ö³¤¶ÈµÄ·´Ð±¸Ü£¬Ôò·µ»ØÔ­À´µÄ2±¶
// ¼´ ʹ°Ñÿ¸ö·´Ð±¸Ü¶¼×ªÒåÁË¡£
return new string('\\', 2 * str.Length);
}



protected void Page_Load(object sender, EventArgs e)
{

// ²âÊÔ´úÂë
string strText = @"'a\'b\\'c\\\'d\\\\'";
System.Diagnostics.Stopwatch swt = new System.Diagnostics.Stopwatch();
swt.Start();
strText = ReplaceQuote(strText);
swt.Stop();
Response.Write("Ì滻ʹÓÃÁ˺ÁÃëÊý£º" + swt.ElapsedMilliseconds.ToString());
string strAlert = string.Format("alert('{0}')", strText);
ClientScript.RegisterStartupScript(this.GetType(), "alert", strAlert, true);
}


Ïà¹ØÎĵµ£º

C# Active¿Ø¼þ£¬²¢´¥·¢javascriptʼþ

´´½¨Ò»¸öWinformÓû§¿Ø¼þ UserControl1
 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;
namespace MyActiveT ......

javascriptµ¯³öÒ»¸öÖ¸¶¨´óСµÄ´°¿Ú


Java´úÂë
<script language="JavaScript">   
function js_show(per_id)   
{   
   window.open('/weihu/person/viewResume.jsp?perID='+per_id, 'resume', 'resizable=yes,menuBar=0,toolBar=0,scrollbars=yes,width=800,height=600,left ......

javascript »ñÈ¡¹ö¶¯Ìõ¸ß¶È+³£ÓÃjsÒ³Ãæ¿í¶ÈÓë¸ß¶È

/********************
 * È¡´°¿Ú¹ö¶¯Ìõ¸ß¶È 
 ******************/
function getScrollTop()
{
    var scrollTop=0;
    if(document.documentElement&&document.documentElement.scrollTop)
    {
        ......

javascript ÄÚ´æй¶¹¤¾ßʹÓÃ

javascriptÄÚ´æ鶵ÄÎÊÌâÒ»Ö±ÒÔÀ´¶¼²»Êܵ½´ó¼ÒµÄÖØÊÓ£¬Ô­ÒòÊǶÔÓû§µÄÓ°ÏìûÓÐ̫ʵ¼ÊµÄ±íÏÖ£¬»òÐí½ü¼¸ÄêÄڴ淢չѸËÙ¡£½Å±¾ÄÚ´æÔÙй¶Ҳ²»»áÓÐÌ«´óÓ°Ïì¡£
µ±È»×÷Ϊǰ¶Ë¿ª·¢µÄͬѧÃÇ£¬¾Í²»ÄÜÓÐÕâÑùµÄ½ÄÐÒÐÄÀí¡£³öÏÖmemory leaksºÜ´ó³Ì¶ÈÉÏÊÇÒòΪ³ÌÐòµÄ²»³ÉÊìºÍ±àÂ벻̫¹æ·¶Ôì³ÉµÄ¡£²»¹ý£¬ÕâÀï¾Í²»ËµÈçºÎ³öÏÖÎÊÌâµÄ£¬¶ÔÎÊÌ ......

¡¾×ª¡¿³£ÓõÄJavaScriptÑéÖ¤ÕýÔò±í´ïʽ

ÏÂÃ涼ÊÇÎÒÊÕ¼¯µÄһЩ±È½Ï³£ÓõÄÕýÔò±í´ïʽ£¬ÒòΪƽ³£¿ÉÄÜÔÚ±íµ¥ÑéÖ¤µÄʱºò£¬Óõ½µÄ±È½Ï¶à¡£ÌØ·¢³öÀ´£¬Èø÷λÅóÓѹ²Í¬Ê¹Ó᣺Ǻǡ£
Æ¥ÅäÖÐÎÄ×Ö·ûµÄÕýÔò±í´ïʽ£º [u4e00-u9fa5]
ÆÀ×¢£ºÆ¥ÅäÖÐÎÄ»¹ÕæÊǸöÍ·ÌÛµÄÊ£¬ÓÐÁËÕâ¸ö±í´ïʽ¾ÍºÃ°ìÁË
Æ¥ÅäË«×Ö½Ú×Ö·û(°üÀ¨ºº×ÖÔÚÄÚ)£º[^x00-xff]
ÆÀ×¢£º¿ÉÒÔÓÃÀ´¼ÆËã×Ö·û´®µÄ³¤¶È£¨Ò»¸ö ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ