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.
Mon 05/05/03 at 14:40
Regular
"You've upset me"
Posts: 21,152
cjh wrote:
> Yeah, sure you were ;)

Heh :-) I find it easier to do (if){thenning} because it's more logical and easier to comprehend.

> No problem, does it work as you'd wanted it too?

It indeed does. I realised why storing the found words in an array produced commas though... Well, actually I didn't but I remembered about the .join() method and used it as alert(found_words.join('.\n')) Did the trick nicely :-)

thanks again :-D
Sun 04/05/03 at 22:05
Regular
"It goes so quickly"
Posts: 4,083
Yeah, sure you were ;)

No problem, does it work as you'd wanted it too?
Sun 04/05/03 at 20:55
Regular
"You've upset me"
Posts: 21,152
Excellent, thanks.

I was thinking about doing it with for loops, but (if){thenning} was what I settled for. If I hadn't got it working through this, then for looping was my fallback plan.

Anyway.

Cheers :-)
Sun 04/05/03 at 17:07
Regular
"It goes so quickly"
Posts: 4,083
ok, I've re-writen it for you, and it seems to do what you wanted.

==================================================


Swear Filter












==================================================
Sun 04/05/03 at 14:58
Regular
"It goes so quickly"
Posts: 4,083
I got it working :)

Although, the pop-up window now likes to come up a load of times before it either submits or doesn't :(

Maybe you can see why, so here is the code I've got:
(I'll keep looking into it though)

----------------------------------------------


Swear Filter











Sat 03/05/03 at 19:18
Regular
"You've upset me"
Posts: 21,152
cjh wrote:
> with:
> found_words += swear_words[swear_words_length] + '.\n';


Excellent. That works. Thanks.

Re: the return problem, if I simply add "return false;" then yes, the form does not submit, so it IS a problem in the function. Exactly what that problem is I really don't know. Maybe it's because it has to cycle through the function more than once? I can't see why that would be the prob though because I've written a form validation script before which works on pretty much the same principle...


Hmmm.
Sat 03/05/03 at 17:18
Regular
"It goes so quickly"
Posts: 4,083
Still looking into it :)

Oh, and language="javascript" is deprecated, its just:

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.