Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

simple javascript

Name: Anonymous 2008-02-07 17:30

Never really got into javascript, found it too hard when i was younger.
Recently I've been asked to make a simple script, i took the task and am finding it impossible seeing as i've been turning up late and stuff.

What I want to do is replace all links on a company blog in this format

1) http://forumnamehere/bbs/thread12345.php
to
2) http://forumnamehere/thread12345.php

i know the answer may be easy but i just can't get the bit with the variable numbers. basically what i'm asking is for a simple bit of javascript which replaces 1 with 2.

I've been trying stuff like this but it doesn't work
s = new String("http://forumnamehere/bbs/thread12345.php");
s = s.replace(/bbs/g,"");
document.write(s);

Name: Anonymous 2008-02-07 17:35

DON'T HELP HIM!!!

Name: Anonymous 2008-02-07 17:37

Do your own high school homework.

Name: Anonymous 2008-02-07 17:37

it's not homework. i'm serious

Name: Anonymous 2008-02-07 17:39

Why can't you just edit the source to be in format 2?

Name: Anonymous 2008-02-07 17:39

Why bother with a regex? Just use s.replace("bbs/","") and be done with it.

Name: Anonymous 2008-02-07 17:40

>>5
I was wondering that too. But it wasn't what I was asked to do.

Name: Anonymous 2008-02-07 17:41

.replace is for chars

Name: Anonymous 2008-02-07 17:49

>>8
I am a Char.

Name: Anonymous 2008-02-07 18:10

>>8
Wrong.

Name: Anonymous 2008-02-07 18:30

>>9
No, you are a Cudder.

Name: Anonymous 2008-02-07 19:09

>>11
The Cudder to my Cons <3

Name: DavidBanner !uo47.HQFFk 2008-02-09 9:48

>>11
GO PLAY IN THE STREET CHILD

Name: Anonymous 2008-02-09 10:15

GO PLAY IN THE CHILD STREET

Name: Anonymous 2008-02-09 10:34

CHILD STREET THE IN PLAY GO!

Name: Anonymous 2008-02-09 13:33

CHILD GO IN THE STREET PLAY

Name: Anonymous 2008-02-09 14:19

STREET CHILD GO IN THE PLAY

Name: Anonymous 2008-02-09 15:20

>>13-17
This could go on for 715 more posts.

Name: Anonymous 2008-02-09 15:54

>>18
ENTERPRISE MATHEMATICIAN?

Name: Anonymous 2010-11-16 4:39

Don't change these.
Name: Email:
Entire Thread Thread List