 |
 |
Javascript help!
|
 |
|
 |
|
Professional Poster
Join Date: Jan 2001
Location: Between Sydney and Melbourne
Status:
Offline
|
|
Im having a problem with my site www.babelbloodyfish.com
The javascript only works in Safari, I need it to work in IE 5/6 for PC too.
Any ideas?
Thanks,
Tom.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Feb 2002
Location: Minnesota
Status:
Offline
|
|
Not sure but try changing....
onClick="cleanText(document.forms[0].jstext)"
to
onClick="jacascript:cleanText(document.formName.js text)"
Make sure to name the form.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status:
Offline
|
|
Twister: nooo......
I took a look at the page yesterday, and there is something screwy that it crashing JavascriptCore... I have not localized it yet, but my first guess is an encoding issue....
onClick="cleanText(document.forms[0].jstext)"
to
onClick="jacascript:cleanText(document.formName.js text)"
This should be:
Code:
onClick="cleanText(document.forms[0].elemts['click me'].jstext)"
IE is very forgiving in making JavaScript errors... but sometimes odd in its interepretations. This is the canocial name for the object, and will work in all JavaScript implementations.
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
Originally posted by larkost:
Twister: nooo......
I took a look at the page yesterday, and there is something screwy that it crashing JavascriptCore... I have not localized it yet, but my first guess is an encoding issue....
[In a voice not dissimilar to Alf from Home and Away...]
Look ya bunch of flamin galahs, you're barking up the wrong bloody gum tree. Stone the crows, a blue-assed fly could see the RegExp is stuffed, the script needs a kick up the khaiber and the replace is more rotten than a dead dingo's donger.
[..Ahem..]
You need to create a valid RegExp in order for .replace() to do its job properly.
So first you need to escape all RegExp characters in the script
E.g.
Code:
addWord("//."," //. ");
addWord(";"," ; ");
addWord("!"," ! ");
addWord("//?"," //? ");
addWord(","," , ");
Then in the main function:-
Code:
function cleanText(formelement)
{
for (i=0; i <keyArray.length; i++)
{
var str = keyArray[i];
var item = new RegExp(keyArray[i],'g');
formelement.value = formelement.value.replace(item, replaceArray[str]);
}
}
This worked for me in Safari (too busy drinking VB to test any other flamin browser)
|
|
Computer thez nohhh...
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status:
Offline
|
|
I've never seen two forward slashes used to escape characters - I thought a single backslash would do (or am I missing something - I'm not on VB, just plain Carlsberg export)... And didn't the original script work in Safari?
Also, didn't Arkham_C write this script in another thread? He might be the best person to ask - especially since the last two replies in this thread are from people who are pissed (or on their way to being)
p.s. mmmmmmmm, Victoria Bitter. I always have that when I go to Bar Oz in Newcastle 
|
|
Just who are Britain? What do they? Who is them? And why?
Formerly Black Book
|
| |
|
|
|
 |
|
 |
|
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status:
Offline
|
|
Originally posted by Simon Mundy:
[In a voice not dissimilar to Alf from Home and Away...]
Look ya bunch of flamin galahs, you're barking up the wrong bloody gum tree. Stone the crows, a blue-assed fly could see the RegExp is stuffed, the script needs a kick up the khaiber and the replace is more rotten than a dead dingo's donger.
This worked for me in Safari (too busy drinking VB to test any other flamin browser)
hahahahahahahahaha!!! awesome. Alf Stewart rules!
attention to detail too, i like it: Alf wouldn't drink that noncey Crown lager, he's a VB man!
|
|
"Have sharp knives. Be creative. Cook to music" ~ maxelson
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Jan 2001
Location: Between Sydney and Melbourne
Status:
Offline
|
|
Originally posted by larkost:
Twister: nooo......
I took a look at the page yesterday, and there is something screwy that it crashing JavascriptCore... I have not localized it yet, but my first guess is an encoding issue....
This should be:
Code:
onClick="cleanText(document.forms[0].elemts['click me'].jstext)"
IE is very forgiving in making JavaScript errors... but sometimes odd in its interepretations. This is the canocial name for the object, and will work in all JavaScript implementations.
Thanks but this doesn't work, it breaks it in Safari.
Im tearing my hair out over this!
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
Originally posted by moonmonkey:
Thanks but this doesn't work, it breaks it in Safari.
Im tearing my hair out over this!
You have some non-printing characters in your source code. When I view the source of the frame in Safari, I see this:
If you fix that, you may find that some of the other problems go away.
|
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
| |
|
|
|
 |
|
 |
|
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status:
Offline
|
|
Originally posted by Arkham_c:
You have some non-printing characters in your source code. When I view the source of the frame in Safari, I see this:
If you fix that, you may find that some of the other problems go away.
grr. i hate that. i soon learnt to have invisibles on in BBE, if i'd copy/pasted some code off a web page. those blighters always seemed to sneak in. (seems to be opt+space, mostly)
|
|
"Have sharp knives. Be creative. Cook to music" ~ maxelson
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Jan 2001
Location: Between Sydney and Melbourne
Status:
Offline
|
|
Originally posted by Arkham_c:
You have some non-printing characters in your source code. When I view the source of the frame in Safari, I see this:

If you fix that, you may find that some of the other problems go away.
OMG! it works!
Thanks!
(Last edited by moonmonkey; Jun 23, 2004 at 08:26 AM.
)
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|