标签:else function turn htm html_ log ret asc javascrip
function convert(str) { // :) //return str; var HTML_Entities = { ‘&‘:‘&‘, ‘<‘:‘<‘, ‘>‘:‘>‘, ‘"‘:‘"‘, "‘":‘‘‘ }; var regExp = /[&<>"‘]/g; var arr = str.match(regExp); if(!arr){ return str; }else{ for(var i = 0; i < arr.length; i++){ str = str.replace(arr[i],HTML_Entities[arr[i]]); } return str; } } convert("Dolce & Gabbana");
标签:else function turn htm html_ log ret asc javascrip
原文地址:http://www.cnblogs.com/mengruying/p/6198364.html