Posts: 256
Location: Auckland, New Zealand
|
Hey Joe,
To direct people to another location just do:
Code:
window.location.href = 'http://disney.go.com/';
Decided to go further and write the whole thing out:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-NZ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bad Word Transfer</title>
<script type="text/javascript">
var profanities = new Array('badword1','badword2','badword3','badword4','badword5');
function check_profanities(comments)
{
var is_profane = false;
var alert_msg = 'We DO NOT accept that type of language:'+"\n";
for (i in profanities)
{
if(comments.toLowerCase().match(profanities[i]))
{
is_profane = true;
alert_msg += profanities[i]+"\n";
}
}
if(is_profane)
{
alert_msg += 'I hope you enjoy Disney, goodbye.';
alert(alert_msg);
window.location.href = 'http://disney.go.com/';
return false;
}
return true;
}
</script>
</head>
<body>
<form action="" method="post" onsubmit="check_profanities(getElementById('comments').value);">
<fieldset>
<legend>Simple Form</legend>
<ol>
<li><label for="comments">Comments:</label> <textarea id="comments" name="comments" cols="25" rows="7" onblur="check_profanities(this.value);"></textarea></li>
</ol>
<div><input id="submit" name="submit" value="Send" alt="Send" type="submit" /></div>
</fieldset>
</form>
</body>
</html>
Cheers,
MC
__________________
#------------------------------ signature---------------------------------------------------------------------------------#
Quote:
|
I am well recognised for what I don't do than what I do. Chores are just one of those things.
|
Last edited by mastercomputers; 09-25-2006 at 05:38 AM..
|