JS¼¼Êõ

javascript ´íÎó¡°È±ÉÙÊ®Áù½øÖÆÊý×Ö¡±µÄ´¦Àí

×ÖºÅ+ ×÷Õߣº À´Ô´£º    2014-11-17 20:00 ÎÒÒªÆÀÂÛ( )

javascript ´íÎó¡°È±ÉÙÊ®Áù½øÖÆÊý×Ö¡±µÄ´¦Àí,ÔĶÁjavascript ´íÎó¡°È±ÉÙÊ®Áù½øÖÆÊý×Ö¡±µÄ´¦Àí,Ô­Òò:JSÌá½»Êý¾Ýʱ³öÏÖÌØÊâ·ûºÅ

Ô­Òò:JSÌá½»Êý¾Ýʱ³öÏÖÌØÊâ·ûºÅ"\"£¬javascriptÖÐ"\"ÊǸöÌØÊâµÄ×Ö·û£¬ÔںܶೡºÏÐèҪת»»¡£
²Î¿¼£º
Àý×Ó³ÌÐò£º
*Encode for HTML.
*/
public static String htmlEncoder(String str)
{
    if(str==null || str.equals(""))
      return "";
    String res_str;
    res_str=strReplace(str,"&","&");
    res_str=strReplace(str," "," ");
    res_str=strReplace(str,"<","&lt;");
    res_str=strReplace(str,">","&rt;");
    res_str=strReplace(str,"\"","&quot;");
    res_str=strReplace(str,"'","'");
    return res_str;
}
/** *//**
*Encode for HTML-Text.
*/
public static String htmlTextEncoder(String str)
{
    if(str==null || str.equals(""))
      return "";
    String res_str;
    res_str=strReplace(str,"&","&amp;");
    res_str=strReplace(str,"<","&lt;");
    res_str=strReplace(str,">","&rt;");
    res_str=strReplace(str,"\"","&quot;");
    res_str=strReplace(str,"'","'");
    res_str=strReplace(str," ","&nbsp;");
    res_str=strReplace(str,"\r\n","<br/>");
    res_str=strReplace(str,"\r","<br/>");
    res_str=strReplace(str,"\n","<br/>");
    return res_str;
}
/** *//**
*Encode for URL.
*/
public static String urlEncoder(String str) {
    return java.net.URLEncoder.encode(str) ;
}
/** *//**
*Encode for XML.
*/
public static String xmlEncoder(String str)
{
    if(str==null || str.equals(""))
      return "";
    String res_str;
    res_str=strReplace(str,"&","&amp;");
    res_str=strReplace(res_str,"<","&lt;");
    res_str=strReplace(res_str,">","&gt;");
    res_str=strReplace(res_str,"\"", "&quot;");
    res_str=strReplace(res_str,"\'", "&acute;");
    return res_str;
}
/** *//**
*Encode for SQL.
*/
public static String sqlEncoder(String str)
{
    if(str==null || str.equals(""))
      return "";
    String res_str;
    res_str=strReplace(str,"'","''");
    return res_str;
}
/** *//**
*Encode for Javascript.
*/
public static String jsEncoder(String str)
{
    if(str==null || str.equals(""))
      return "";
    String res_str;
    res_str=strReplace(str,"'","");
    res_str=strReplace(str,"\"",""");
    res_str=strReplace(str,"\r\n","");
    res_str=strReplace(str,"\n","");
    res_str=strReplace(str,"\r","");
    return res_str;
}
html=html+replace(table_list(fileExt,path,2),"\","/")+""""

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • ÀÏÉú³£Ì¸£¬JavaScript±Õ°üÖеÄthis¶ÔÏó

    ÀÏÉú³£Ì¸£¬JavaScript±Õ°üÖеÄthis¶ÔÏó

    2016-02-26 10:21

  • ѧϰJavaScriptÖ®this,call,apply

    ѧϰJavaScript֮this,call,apply

    2016-01-28 20:45

  • JavaScript¸´Ï°±Ê¼Ç--×Ö·û´®

    JavaScript¸´Ï°±Ê¼Ç--×Ö·û´®

    2016-01-27 17:16

  • WEBÇ°¶Ë½Ì³Ì-JavaScriptÀïµÄÀàºÍ¼Ì³Ð

    WEBÇ°¶Ë½Ì³Ì-JavaScriptÀïµÄÀàºÍ¼Ì³Ð

    2016-01-21 15:28

ÍøÓѵãÆÀ
Î