...

View Full Version : Construct URL



vivekkam
12-04-2012, 11:18 PM
Hi,

I have a more than 1000 URL'S like:

localhost/foldername/trainer/7.1.0.73/frameset.html

where only the foldername changes in the URL.

Now I need a functionality on my page where there are links which has the name same as the folder name and on clicking it , it automatically replaces the name with the foldername and generates and opens the url for me.

For eg:

Suppose there is link with name : OrderEntry . So on clicking it the following URL should be generated:

localhost/OrderEntry/trainer/7.1.0.73/frameset.html

and opened in the browser. Any kind of help would be appriciated.


Thanks in advance .

Regards,

Vivek

Old Pedant
12-04-2012, 11:44 PM
???

And so why not simply use


<a href="localhost/OrderEntry/trainer/7.1.0.73/frameset.html ">Order Entry</a>

Presumbably, you are generating these links with some server-side code (PHP/ASP/JSP/etc.). No? So let the server side code do it.

But if you *must* do it in JavaScript, I guess you could do something like this:


<a onclick="this.href='localhost/' + this.innerHTML.replace(/\W/g,"") + '/trainer/7.1.0.73/frameset.html'; return true;">
Order Entry
</a>

The call to replace there will remove all characters except letters, digits, and underlines from the text between the <a> and </a> tags.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum