Hi today i will explain you how to filter out inappropriate words from being updated or send from your website.This is simple javascript.
badwords.js
Contains javascript code. If you want add some more words in bad_words_array
var bad_words_array=new Array("badword-1","badword-2","badword-3");
function badwords(txt)
{
var alert_arr=new Array;
var alert_count=0;
var compare_text=txt;
for(var i=0; i<bad_words_array.length; i++>)
{
for(var j=0; j<(compare_text.length); j++)
{
if(bad_words_array[i]==compare_text.
substring>(j,(j+bad_words_array[i].length)).toLowerCase>())
{
alert_count++;
}
}
}
return alert_count;
}
index.html
Contains javascript and HTML code. The form calling Message() function.
<script type=">text/javascript" src=">badwords.js"></script>
<script type=">text/javascript">
function Message()
{
var textbox_val=document.form.textbox.value;
if(textbox_val=="")
{
alert("Please enter a message");
return false;
}
bwords=badwords(textbox_val);
if(bwords>0)
{
alert("Your message contains some bad words please remove it.");
document.form.textbox.focus();
return false;
}
}
</script>
<form action="send.php" method="post"
onsubmit="return Message();" name="form">
<textarea name="textbox"></textarea>
<input type="submit" value=" Submit "/>
</form>
Thanks and regard
bALu
Incoming search terms:
- textbox jquery validation in php (4)
- jquery validation for textbox in php (3)
- word file validation in javascript (3)
- word validation javascript (2)
- jquery textbox array validation (2)
- remove bad words javascript (2)
- validation in javascript (2)
- web technologies validations for javascript (2)
- html scripts/codes (2)
- how to prevent abusive words in javascript (2)
- how to prevent bad words in javascript (2)
- how to replace a bad word in a textbox with javascript (2)
- word validation in javascript (2)
- words validation for abusive (2)
- javascript code for bad word alert (2)
- terms validation script (2)
- word verification example using javascript (2)
- Bad word jquery (2)
- word verification script (2)
- send Verification code message on mobile script using php (1)
- search words in page code in javascript (1)
- search terms validation (1)
- replaxe bad words javascript code (1)
- text area spam validation (1)
- simple javascript textbox validation alert message (1)
- swear_words jquery (1)
- sending 2 words through javascript function (1)
- swear words checking in javascript (1)
- stop inapropreate words using php (1)
- symfony the server returned a 500 internal server error htaccess (1)
- terms textbox validation html code (1)
- special words validation in javascript (1)
- special character validation on keypress using javascript (1)
- terms validation javascript (1)
- simple code for word verification in javascript (1)
- stop abuse word validation in javascript (1)
- remove bad word from text box + jquery (1)
- onkeypress validation for special characters (1)
- js bad words validation (1)
- ON KEYPRESS VALIDATION AND REPLACE CHARACTER IN JQUERY (1)
You will also be interested in ,
- Simple page flip effect using Jquery, css and simple html
- Text auto slide information box using javascript.
- Give a welcome alert message to your visitors using javascript
- Add a splash page using javascript
- Detect browser and redirect using javascript
- Add to favorites or bookmarking using javascript in firefox and internet explore [IE]
- Simple Javascript Clock
- Javascript Alert Message Box When Clicking A Link
- DOM elements dynamically using our JAVASCRIPT
- Changing the image by dynamically changing the image source using javascript
