5 replies [Last post]
rsnetworks
Offline
newbie
Last seen: 11 years 7 weeks ago
Timezone: GMT-8
Joined: 2003-06-10
Posts: 2
Points: 0

I am new to CSS but am eager to learn as much as possible. Right now I would like to know if CSS is capable of displaying URL's from a specific list. To clarify, I have a site (or will have) that contains multiple links to pages on other sites. If one of these other sites happens to modify the location of the page I am linking to, I would like to have the ability to change my reference to that link in only one place, regardless of how many times or on how many of my pages I use that particular link. Is this an available function of CSS?

Tags:
Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 7 hours 28 min ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5080
Points: 2658

Use CSS to display specific links

Hi Rsnetworks,
This isn't a feature available in CSS.

Luckily there are other ways you can do it.

If you are handy at a scripting language such as PHP or JavaScript, you could
write a function which stores the link addresses in an array then just call the array with the correct index to get the address.

Or you could store the address in a database.

If these suggestions sounds way to confusing there are scripts freely available to do it for you.

I created a linksystem a while ago that stores the address in a MySQL database.
The main purpose was to have one link page with many links and keep track of clicks.
You could easily use it for your site if you have PHP and MySQL available.

rsnetworks
Offline
newbie
Last seen: 11 years 7 weeks ago
Timezone: GMT-8
Joined: 2003-06-10
Posts: 2
Points: 0

Use CSS to display specific links

Awesome, thank you for the information. Do you know of any sites where I might find these types of JavaScripts (unfortunately, I will not have access to PHP on the server where my site will be stored). Thanks again.

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 7 hours 28 min ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5080
Points: 2658

Use CSS to display specific links

Hi Rsnetworks,
Your external JavaScript file would contain

function linksa(x){
   var linkarray= new Array();
   linkarray[0]="<a href='www.appcreator.com'>appcreator</a>"; 
   linkarray[1]="<a href='www.csscreator.com'>csscreator</a>";

   return linkarray[x];
}

In the Head section of each of your pages add<script language="JavaScript" src="filename.js"></script>

In the document where you want a link

<script language="JavaScript" type="text/javascript">
<!--
document.write(linksa(1));
document.write(linksa(0));
//-->
</script>

KnightWolfJK
KnightWolfJK's picture
Offline
Enthusiast
Washington, DC
Last seen: 7 years 5 weeks ago
Washington, DC
Timezone: GMT-5
Joined: 2003-06-10
Posts: 210
Points: 0

Use CSS to display specific links

Someone's bored... :?:

Diplomacy is the art of letting someone have your way

Daniel
Daniel's picture
Offline
Enthusiast
Last seen: 9 weeks 4 days ago
Timezone: GMT+10
Joined: 2003-03-12
Posts: 76
Points: 0

Use CSS to display specific links

KnightWolfJK wrote:
Someone's bored... :?:

Looks like it.

Posts have now been deleted.