-1
我想知道如何更換javascript.I一個不規則的表達都試過我讀的計算器,但其還沒有成型。 我想更換所有spaces.Here +是我的代碼替換所有不規則的表情
<script>
String.prototype.replaceAll = function(find,replace){
var str= this;
return.replace(new RegExp(find.replace(/[-\/\\^$*?.()|[\]{}]/g, '\\$&'),'g'), replace); };
$(document).ready(function(){
$('#myform').submit(function(){
var selectedItemsText = '';
$(this).find('input[type="checkbox"]:checked').each(function(){
selectedItemsText += $(this).val() + '\r';
});
selectedItemsText=selectedItemsText.replaceAll('+',' ');
if (confirm("Are you sure you would like to exclude these folders(s)?"+selectedItemsText))
{
$.ajax({
type:"POST",
url:catalog2.php,
data:$('#chk[]').val(),
});
}
return false;
});
});
</script>
看看控制檯中的語法錯誤在會發生在定義'replaceAll' –
你可以定義「不工作」,也許你的代碼減少到[小例子(http://stackoverflow.com/help/mcve)? –
反正什麼是「不規則表達」? – evolutionxbox