PDA

View Full Version : changing how it works!


Crash1hd
05-09-2003, 08:51 AM
Ok I was wondering how I would change the following code!

var whichpage = document.URL.substring(7, document.URL.indexOf('.'));
var oRegExp = new RegExp('/Images\/Text\/' + whichpage + '.jpg', 'gi');
HTML = HTML.replace(oRegExp, '/Images/Text/' + whichpage + 'down.jpg');

It is set so that if the header is http://members.site.ca/ then the image would be membersdown.jpg I want to make the web link to be

http://www.site.com/members.asp how would I change the code to make that work?

Mr J
05-09-2003, 11:33 PM
Changing the line

var whichpage = document.URL.substring(7, document.URL.indexOf('.'));

to


var whichpage = document.URL.substring(20, document.URL.lastIndexOf('.'));


Should give you members from the string

"http://www.site.com/members.asp"

Crash1hd
05-10-2003, 05:14 AM
Thankyou I will give that a try!