Forum Dictionary / 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