View Single Post
Old 11-09-2005, 11:59 AM   #3
bsquare
Member
bsquare knows what time it isbsquare knows what time it isbsquare knows what time it isbsquare knows what time it isbsquare knows what time it isbsquare knows what time it isbsquare knows what time it isbsquare knows what time it isbsquare knows what time it isbsquare knows what time it isbsquare knows what time it is
 
Posts: 24
Karma: 2128
Join Date: Dec 2002
Yeah, I was trying to figure out a way to do that as well. Wasn't familiar with the "lastIndexOf()". That is similar to another one I'm looking at, AnandTech. The Story ID is the last number of the URI, but it isn't right after the last /. Can I use another char maybe, like the "?"
So the story URI is:
http://www.anandtech.com/cpuchipsets...oc.aspx?i=2598

and to grab the last "i=2598" to turn it into:
http://www.anandtech.com/printarticle.aspx?i=2598

should be something like this?:
document.onanchorlink = function(link) {
link.referrer = link.uri;
var filename = link.uri.substring(link.uri.lastIndexOf('?'));
link.uri = "http://www.anandtech.com/printarticle.aspx?" + filename;
};

Or am I not grasping the concept of this lastIndexOf call?
bsquare is offline