www.webdeveloper.com
Results 1 to 3 of 3

Thread: random text display ussue

  1. #1
    Join Date
    Nov 2011
    Posts
    11

    random text display ussue

    Code:
    <script language="JavaScript">
    <!--
    var r_text = new Array ();
    r_text[0] = "http://google.com";
    r_text[1] = "http://yahoo.com";
    r_text[2] = "http://hotmail.com";
    
    
    var i = Math.floor(3*Math.random())
    
    document.write(r_text[i]);
    
    //-->
    </script>


    when i put this script in html page

    the links appear randomly but with no hyper link so the visitor can't enter the site by clicking link but he should copy it and put it in the browser



    so what i should do to hyperlink the links ?

    srry 4 bad eng
    thanks

  2. #2
    Join Date
    Nov 2011
    Posts
    19
    You must create a HTML hyperlink and insert Your result into it.

    Change last line to :
    Code:
    document.write("<a href='"+r_text[i]+"'>" +r_text[i] + "</a>");

    -------------
    Jacek Jeznach
    Web developer

  3. #3
    Join Date
    Nov 2011
    Posts
    11
    working greaaaaaat

    thanks bro

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles