0

sanitized output

I <html> <body bgcolor="gold"> <form> <label for="m_data">malicious data:</label> <input type="text" char rem='@' char i; for(i=0;i<str.length;i++) { var ch=charAt(i) if(rem==ch){ str=str.replace("str", @); document.write(str); }}><br><br> <input type="submit"> </body> <html> i want when i write Reem@ the output will come only Reem the @ removed .. what’s wrong in my code ???

15th Mar 2021, 5:14 AM
Azza
5 Answers
+ 1
you're welcome â˜ș
15th Mar 2021, 4:31 PM
Abir Hasan
Abir Hasan - avatar
+ 1
The way you put your Javascript code is not valid. And you can remove @ without using a loop. Take a look at the fixed code below. https://code.sololearn.com/Wip24708w3R3/?ref=app
15th Mar 2021, 6:11 AM
Abir Hasan
Abir Hasan - avatar
+ 1
@Azza do you mean input box? If so then after submitting the information the form should just be empty. Why would you need to show the output to the user form. Also I'm not even sure how to do that.
15th Mar 2021, 3:26 PM
Abir Hasan
Abir Hasan - avatar
0
Thanks Abir Hasan 😍 but how can display the output inside the textbox ??
15th Mar 2021, 1:38 PM
Azza
0
exactly Abir Hasan My teacher asked me that he told me try đŸ€·đŸ»â€â™€ïž ok thank you Abir💖
15th Mar 2021, 4:30 PM
Azza