Hi, If some one can guide me to the right direction I'm trying to use arrays to display urls in one line and under the url the text name of the href text. The second function it doesnt work some help will appreaciated.
thank you.

    <meta http-equiv="content-type" content="text/html" />
    <meta name="author" content="lolkittens" />

    <title>Untitled 2</title>

<script type="text/javascript">
url_list = new Array(
["Link name google","http://www.google.com"],
["Link name yahoo","http://www.yahoo.com"],
["Link name msn","http://www.msn.com"]

link_text = new Array(
["Link TEXT:name google","http://www.google.com"],
["Link2 TEXT: name yahoo","http://www.yahoo.com"],
["Link3 TEXT:name msn","http://www.msn.com"]

function link(){
var seed=Math.floor(Math.random() * url_list.length);
document.getElementById("url1").href = url_list[seed][1];
document.getElementById("url1").innerHTML = url_list[seed][0]; setTimeout('link()',1000);}

function link2(){
var seed=Math.floor(Math.random() * link_text.length);
document.getElementById("url2").href = link_text[seed][1];
document.getElementById("url2").innerHTML = link_text[seed][0]; setTimeout('link()',1000);}

function init() {

<script type="text/javascript">
<a href="#" id="url1"></a><br />
<a href="#" id="url2"></a>


Recommended Answers

All 3 Replies

explain "isn't working" please.

what are you expecting it to do, what does it do?

NO, is not working the second array link_text is not showing the right name of the url when the url_list is changing.

Sorry I did not explain it well.


is link2() function suposed to be calling link() on line 29?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.