• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

Need javascript code for testing an html text box

I need a short piece of javascript code to put inside a text edit box to test that scripting is properly prohibited.  I know I could go find something in searching, but this way is much more fun!
0
cornell256
Asked:
cornell256
  • 2
  • 2
1 Solution
 
rugu_16Commented:
can you give an example?
0
 
cornell256Author Commented:
any code that is in javascript.  I need to test that when a user puts in script to a text edit box on my website, they cannot maliciously put in some evil script.  (Scripting is prohibited from the textedit box, I just need to confirm that this is so.)

I already tried the html script tag, and confirmed this works OK.
ie. I added text within script</script> and upon saving, the script tags are removed.
0
 
programmer1024Commented:
Hmm..I guess you would create and array of "bad" script keywords, perform a search, and compare EACH bad script against EACH word in the textbox. As far as the "bad" script keywords..Imagine the possibilities! This one goes under consideration..
0
 
cornell256Author Commented:
No, scripting is turned off. I should not be able to run any script in the text box. but not being a script programmer, I need a code piece to put in as if I were an evil hacker, and try to run it. the program should change it to just text.
0
 
programmer1024Commented:
Since you are able to remove the script tags, that should suffice. Right? Without tags, the script won't run.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now