Web Analytics Made Easy -
StatCounter Help! - CodingForum

Announcement

Collapse
No announcement yet.

Help!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help!

    Hello! I am new to the board and I have a question. I am giving myself a serious headache with this and I am hoping you know how to help. I got the following code from this site and I need it altered just a tad and I am unable to do it correctly. This code is for Random Link display. I need it to open in a NEW window instead of taking visitors away from my site.

    Please Help!

    <script>
    <!--
    /*
    Random link button- By JavaScript Kit (http://javascriptkit.com)
    Over 300+ free scripts!
    This credit MUST stay intact for use
    */

    //specify random links below. You can have as many as you want
    var randomlinks=new Array()

    randomlinks[0]="http://freewarejava.com"
    randomlinks[1]="http://javascriptkit.com"
    randomlinks[2]="http://dynamicdrive.com"
    randomlinks[3]="http://cnn.com"
    randomlinks[4]="http://www.geocities.com"

    function randomlink(){
    window.location=randomlinks[Math.floor(Math.random()*randomlinks.length)]
    }
    //-->
    </script>
    <form>
    <p><input type="button" name="B1" value="Mystery Links!" onclick="randomlink()"></p> </form>

    <!--Uncomment below to use a regular text link instead
    <a href="javascript:randomlink()">Random Link</a>
    -->


    Last edited by Elven Mystress; Feb 12, 2004, 03:23 AM.

  • #2
    Welcome here !

    Some of the reasons why noone reacts are probably:
    - this is posted in the wrong forum, since it's clientsided javascript
    - the subject is the top 1 example of poor subjecttitles --> read the posting guidelines, please : http://www.codingforum.net/postguide.htm
    - opening in a new window is poor coding practice so some peole wount tell you how, because they don't wan't to promote it:
    *opening links in a new window, just because you fear that the user wil not come back to your site, says quite a bit about your site : if it's any good, then people will return to it.
    * the newer xhtml standards doen't even include targets.
    * the newer user agents like palms etc doen't work with windows --> it's a doomed to extinct concept
    * popup blocker issues that will prevent some clients from being able to follow the links
    - a quick google search or a search on this forum will tell you how toopen a link in a new window
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

    Comment

    Working...
    X