FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

How to create links in one .js file?

 


tamilparks
Friends i am having webpage i want to place the link exchanges in one .js file when some friends are submiting when i edit the .js file it will have to update all the places where i am using the .js file (because its very difficult to update the links in all my pages) can anyone help me pls
jabapyth
... is this what you're looking for?

in your pages
Code:
<script src="links.js"></script>


links.js
Code:
var links = new Array(
new Array("http://google.com","Google"),
new Array("http://netvibes.com","A great homepage"),
new Array("http://jabasite.ej.am","Jabapyth's homepage :)"))

for (var i=0;i<links.length;i++){
    document.write("<a href='"+links[i][0]+"' alt='"+links[i][1]+"'>"+links[i][1]+"</a><br>")
}

tamilparks
ok thanks i will check and tell you
tamilparks
ok thanks to jabapyth its very nice to see... its working... is it possible to add styles.... link http://tamilparks.50webs.com to add the affiliate /sponsor links...

thanks in advance
qscomputing
Just wondering what you intend to do about users who don't have Javascript support. If you want to do something like this it should be done *server side* - ie with PHP or similar. Or, use a script on your own computer to update the links before you upload the pages.
tamilparks
i like the script very much .. but i want a small help also.......

is it possible to add the font style and remove the underline in the link please help me
tamilparks
is there any possible....
Stubru Freak
Yes, just change the style of the <a> tag that gets document.written.
But qscomputing is right, you should use PHP for this.
tamilparks
Stubru Freak thanks

but i dont know how to change can you please give me the code
Stubru Freak
tamilparks wrote:
Stubru Freak thanks

but i dont know how to change can you please give me the code


links.inc.php:
Code:

<a style="style information" href="URL">Link text</a>


Where you want to show the links:
Code:

<?php include('links.inc.php'); ?>
alem
if you ask hanging style of th a a tags, you can do it with a css file.

yourcssfile.css
Quote:
a{
font-style: 12px arial;
text-decoration:none;
}


and to add this css file to ant of your page include
Quote:
<link rel="stylesheet" href="yourcssfile.css" media="all" type="text/css" />

between your head tags.

you can do much more things with css. just follow the link and go step by step by clicking next.
tamilparks
thanks for the help i am using only the html because i have no idea about php
Stubru Freak
tamilparks wrote:
thanks for the help i am using only the html because i have no idea about php


It's really not hard, and it works a lot better. I'd recommend trying to understand it.
tamilparks
ok thanks Stubru Freak,

any others know about this please help
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.