GetDotted Domains

Viewing Thread:
"Some Javascript Help"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Fri 02/05/03 at 20:27
Regular
Posts: 787
Hi.

Right, basically I'm trying to write a swear checker function. The code is this:





















The swear checker itself seems to work - it chucks up an alert if any of the words are found - but what it doesn't do is stop the form from doing it's action. So even if the alert comes up, the 'return false;' part of it never seems to get through and I really don't know why.
As well as that in the alert, if there's more than one word, there's always a comma before every word after the first and I cannot ascertain as to why.

Any ideas?

Cheers.
Sat 03/05/03 at 11:13
Regular
"tinycurve.gif"
Posts: 5,857
Here's one thing I noticed which I thought was pretty obvious, but it may not be the only problem with the script:

Change:


to:
Sat 03/05/03 at 02:31
Regular
"bing bang bong"
Posts: 3,040
First of all, I know absolutely SFA javascript

Regarding your first problem, I would hazard a guess it's to do with the value being returned. If the line:



Were hard coded:



..does that definetly do what you want it to do (presumably stop the form from submitting)? If it does, I would look at the actual value being returned your swear_checker() function - try outputting it in a popup box or something.


Regarding your second problem, I would guess it's just what you get when you output an array - you get each value printed, with a comma in between. If you want more control, make a loop to cycle through all the elements in the array, which will give you as much control as you want over how it's written to screen.
Fri 02/05/03 at 20:27
Regular
"You've upset me"
Posts: 21,152
Hi.

Right, basically I'm trying to write a swear checker function. The code is this:





















The swear checker itself seems to work - it chucks up an alert if any of the words are found - but what it doesn't do is stop the form from doing it's action. So even if the alert comes up, the 'return false;' part of it never seems to get through and I really don't know why.
As well as that in the alert, if there's more than one word, there's always a comma before every word after the first and I cannot ascertain as to why.

Any ideas?

Cheers.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Excellent
Excellent communication, polite and courteous staff - I was dealt with professionally. 10/10
Just a quick note to say thanks for a very good service ... in fact excellent service..
I am very happy with your customer service and speed and quality of my broadband connection .. keep up the good work . and a good new year to all of you at freeola.
Matthew Bradley

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.