Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Help!

  1. #1
    New to the CF scene
    Join Date
    Feb 2004
    Location
    Jackson, GA
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Java Script. Need Assistance.

    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; 02-12-2004 at 08:23 AM.

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.codingforums.com/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 Permissions

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