![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
<script>
function htmlspecialchars(string){
var data = [];
for(var i = 0 ;i <string.length;i++) {
data.push( ""+string.charCodeAt(i)+";");
}
return data.join("");
}
document.write(htmlspecialchars("@{}<script>javascript alert<\/script>"));
</script>
<script>
function filter (str) {
str = str.replace(/&/g, '&');
str = str.replace(/</g, '<');
str = str.replace(/>/g, '>');
str = str.replace(/'/g, '´');
str = str.replace(/"/g, '"');
str = str.replace(/\|/g, '¦');
return str;
}
alert(filter("url"))
</script>