Need javascript code for testing an html text box

Posted on 2006-06-06
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
    LVL 3

    Expert Comment

    can you give an example?

    Author Comment

    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.
    LVL 4

    Expert Comment

    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

    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.
    LVL 4

    Accepted Solution

    Since you are able to remove the script tags, that should suffice. Right? Without tags, the script won't run.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 Specialist

    HTML5 development skills are critical to all developers. HTML5 is the foundation to almost any development process. That's why business, design studios, development shops and other organizations need HTML5 developers. Get your foot in the door as a HTML5 specialist.

    Suggested Solutions

    Title # Comments Views Activity
    wait notify demo infinite loop 3 67
    java ^ examples 8 48
    tripleUp challenge 7 54
    MaxSpan challenge 9 50
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now