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:
- jquery validation for textbox in php (7)
- word validation javascript (5)
- jquery block bad words (5)
- word verification javascript (4)
- textbox jquery validation in php (4)
- modsecurity xampp ubuntu (4)
- word file validation in javascript (3)
- how to validate the rating in the javascript (3)
- validation in javascript (3)
- validate for bad word using jquery (2)
- word validation in javascript (2)
- jquery textbox array validation (2)
- doc: jsp code for validation of number (2)
- how to prevent bad words in javascript (2)
- terms validation script (2)
- html scripts/codes (2)
- how to replace a bad word in a textbox with javascript (2)
- how to prevent abusive words in javascript (2)
- how to banned badword in a textbox using jscript (2)
- remove bad words javascript (2)
- how to validate bad words in php (2)
- javascript word validation (2)
- HOW TO VALIDATE A WORD IN JAVA SCRIPT (2)
- javascript code for bad word alert (2)
- web technologies validations for javascript (2)
- word verification example using javascript (2)
- words validation for abusive (2)
- javascript block the bad words in javascript (2)
- add remove text boxes dynamically in javascript yii (2)
- word verification code in java script (2)
- word verification script (2)
- Bad word jquery (2)
- javascript bad word function (2)
- bad word validation jquery (2)
- jquery word verification (2)
- sending 2 words through javascript function (1)
- send Verification code message on mobile script using php (1)
- simple code for word verification in javascript (1)
- select search ajax php mysql script (1)
- textbox time verificator java script (1)
You will also be interested in ,
- Load webpage dynamically from query string using simple javascript and iframe
- Dynamically Changing hyperlink color on a website using javascript
- Beautiful Christmas countdown timer complete webpage with css download free
- Capitalize first letter or alphabet of a input field using javascipt
- Change webpage background color using javascript
- Disable submit button on form submit
- Passing variables from javascript to php
- Disabling right click menu using javascript Enhanced Version
- Text auto slide information box using javascript.
- Auto refresh page with timer using javascript

