try this
Code:
function filter_value(){
var txt = document.getElementById(your_posting_form_textaria_id).value;
var unwanted = /www./i;
document.getElementById(your_posting_from_textaria_id).value = txt.replace(unwanted, '');
document.getElementById(your_posting_form_id).submit();
}
document.getElementById(your_posting_form_id).onsubmit = filter_value;
example
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Filter value</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
select{margin:5px 10px;padding:3px 7px 3px 5px;border:none;}
div#content{text-align:center;padding-top:100px;}
</style>
<script type="text/javascript">
function filter_value(){
var txt = document.getElementById('inp').value;
var unwanted = /www./ig;
/*
var unwanted = /(http:\/\/)?www./ig;
use this if you want to remove http:// aswell
*/
document.getElementById('inp').value = txt.replace(unwanted, '');
/*
the two lines below are just for testing
remove them and uncomment the last line
*/
document.getElementById('result').innerHTML = document.getElementById('inp').value;
return false;
//document.getElementById(your_posting_form_id).submit();
}
function set_posting_form(){
document.getElementById('p_f').onsubmit = filter_value;
}
window.onload = set_posting_form;
</script>
</head>
<body>
<div id="content">
<form id="p_f" action="">
<textarea id="inp" cols="50" rows="5"></textarea><br /><br /><br />
<input type="submit" />
</form>
<div id="result"> </div>
</div>
</body>
</html>
Bookmarks