/ Programming / 網頁/網站程式 / JavaScript /

Javascript 中類似 PHP 的 addslashes 函式

New Subject
Random
Previous
Next
|
Javascript 中類似 PHP 的 addslashes 函式

嗚~
找不到 addslashes 函式 ,在 Javascript 裡有沒有辦法可以處理 " 的問題丫?
  • Keywords : 找不到, 問題丫, 函式, addslashes, Javascript
0 0
2008-12-02T08:54:21+0000

魚戀秋波 Neil Y.K. :

目前為止還我還沒發現 Javascript 內建的跳脫函式,所以用 replace 來代替囉!

function addslashes(str){
 str=str.replace(/'/g,"'");
 str=str.replace(/"/g,'"');
 str=str.replace(//g,"");
 str=str.replace(//g,'');
 return str;
 }
function stripslashes(str){
 str=str.replace(/'/g,"'");
 str=str.replace(/"/g,'"');
 str=str.replace(//g,"");
 str=str.replace(//g,'');
 return str;
 }

0 0
2008-12-02T09:05:19+0000

學生妹瀨043811 :

!!! The contents has been hidden because it violates policy tactic. !!!
0 0
2019-01-29T16:51:54+0000


  • Now, you can post comments by Facebook Account when your Yampiz account was logout or unvariable. whatever, we suggest to post comment by Yampiz Account to get more bounds to join new events of Heyxu
Comment
 
Verify

Archive DIR

    Facebook Page

    QR-Code and APP Launcher

    User Guide
    This Webpage

    In those service tabs, "Scan QRCode, in mobile device" or "Click the button, in this device" to open webpage or APP-related operations.
    QRCode
    • Auto Platform
      For better browsing experience, it will auto detects your device to display webpage.
    • Bug Report
      Tell us about the idea, problem and errors you found.
    • Comodo Secure
      The sensitive data transmission adopts by SSL-2048 authenticated encryption.
    • Copyright
      © 2009 YamPiz Digital Inc. & Jaby Group. All rights reserved.
    • Revised Version
      V2.2.207
      06 Jan 2025 (GMT+8)