[Last Call] Learn how to a build a cloud-first strategyRegister Now


Need javascript code for testing an html text box

Posted on 2006-06-06
Medium Priority
Last Modified: 2013-11-13
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!
Question by:cornell256
  • 2
  • 2

Expert Comment

ID: 16845149
can you give an example?

Author Comment

ID: 16845198
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.

Expert Comment

ID: 16845639
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..

Author Comment

ID: 16854994
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.

Accepted Solution

programmer1024 earned 1000 total points
ID: 16856722
Since you are able to remove the script tags, that should suffice. Right? Without tags, the script won't run.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Starting up a Project

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question