简体   繁体   English

转义HTML和Javascript标签

[英]Escape HTML and Javascript tags

I have a editable textbox. 我有一个可编辑的文本框。 If I will enter alert('Hi'); 如果我要输入alert('Hi'); , then it saves properly. ,则可以正确保存。 After saving it will forward to a list page where that text box value will be a hyperlink. 保存后,它将转发到列表页面,该文本框值将是一个超链接。 If we click on that hyperlink then alert displays. 如果我们单击该超链接,则会显示警报。 But we want to escape this. 但是我们想逃避这个。 Can any one have the resolution for this ? 有人可以解决这个问题吗? Thanks in advance 提前致谢

Before the text is saved for further processing or display, replace all "<" by "&lt;" 在保存文本以进行进一步处理或显示之前,请将所有"<"替换为"&lt;" and replace all ">" by "&gt;" 并将所有">"替换为"&gt;"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM