View Full Version : javascript request to an always index to addys

07-10-2006, 09:50 PM
ok i was wondering if there is a javascript out there that can put an index to all html's out addies for example in my html i have many out going html's such as href="http://www.website.com/" and mabe later in the html i have a different href= "http://www.website.org/ what i want to do is put a ?randtour.php?ref=mycode&pps=num at the end of all the html's when the go out but not have to type them all out , i hav alot links on one webpage but i really don't want to have to go thru all of them and type in the ?nameof.php?ref=mycode&pps=num at the end of them all ok like i can have

<IMG alt=[IMG] src="icons/image2.gif"> <A href="http://www.website.com/1/name1/descript/">name of web</A> 10-Feb-2002 11:18 28k
<IMG alt=[IMG] src="icons/image2.gif"> <A href="http://www.website.com/1/name2/descript/">name of web</A> 10-Feb-2002 11:18 35k

so when they click on it, it will read on there address bar http://www.website.com/1/name1/descript/?nameof.php?ref=mycode&pps=num can any one help i'm also looking for some thing similar like having the javascript put the http://www.website.com/ at the biggining and the ?nameof.php?ref=mycode&pps=num at the end so all i have to write the middle part like href="1/name1/descript/" and it will come out like http://www.website.com/1/name1/descript/?nameof.php?ref=mycode&pps=num
any suggestion or ref to a javascript that i can use cause i want to have the javascript as a seperet file "name.js" so if some one selects at the view/source and only see's 1/name1/descript/ so they can't use it to jump thru my website
thanks in advance

07-10-2006, 10:50 PM
You'd be much better served with a stream editor like sed to text replacements.

The only way to do this in JavaScript without having to type everything out is to loop over all a elements ( getElementsByTagName("a") ) and check to see if the href contains your domain and if not replace the href with what you want.

document.onload = function()
var hrefs = document.getElementsByTagName("a");

for (var i = hrefs.length - 1; i>=0; --i)
if (hrefs[i].href.lastIndexOf("www.mydomain.com") == -1)
if (hrefs[i].href.lastIndexOf("?") == -1
hrefs[i].href += "&arg1=5&arg2=6";
hrefs[i].href += "?arg1=5&arg2=6";

07-13-2006, 11:19 PM
Most of my web outs have my domain on them there are only a few. most of my out addies have http://www.mydomain.com/ and then my directories like
1/name1/descript/, 1/name2/descript/, 2/name1/descript/, 3/name3/descript1/ etc. but i want to put the ?nameof.php?ref=mycode&pps=num at the end of all of them without typing them out +tag+ 3/name3/descript1/ +U+ like tag=http://www.mydomain.com/ & u=?nameof.php?ref=mycode&pps=num as for the other domain addies all i need is the ?nameof.php?ref=mycode&pps=num at the end of it.

For right now I'm just looking for the +U+ (?nameof.php?ref=mycode&pps=num) thing at the end of all the addies. i need the javascript and html edit to make this work.

Thank You very much for your input.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum