#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    3
    Rep Power
    0
    I'm putting an ad rotater on my website and it uses frames. This is the code
    <!-- Hide from JavaScript-Impaired Browsers
    /* First, if you load fewer or more than 6 sponsors
    into your rotator, change the "sponnr" variable
    to the actual number of sponsor .gifs you plan to
    load. */
    number_of_sponsors=6;

    var sctr=0;
    var halt=0;
    var isn=new Array();
    for (i=0;i<number_of_sponsors;i++){
    isn[i]=new Image();
    }

    /* The sponsor .gif names are loaded into the isn[x]
    sponsor images array. You may load any number of
    sponsor images (.gif or .jpg or both) into this
    array. They must all be the same size, however.
    Substitute your own .gif filenames for the ones
    shown here. Note that the first .gif must appear
    in the isn[0] array element. */
    isn[0].src="forums.gif";
    isn[1].src="g/infopcf.gif";
    isn[2].src="g/webw.gif";
    isn[3].src="g/netsc.gif";
    isn[4].src="g/jss.gif";
    isn[5].src="g/pentax.gif";

    /* Finally, replace the URL's below with those of
    your sponsors IN THE SAME ORDER. */
    var durl=new Array();
    durl[0]="";
    durl[1]="";
    durl[2]="";
    durl[3]="";
    durl[4]="";
    durl[5]="";

    /* This script is set to rotate every 10 seconds.
    (5000=5 seconds, so 30000 would equal 30, etc)
    You should change the number in the setTimeout()
    call below for the number of seconds you wish. */
    function rotateIt(){
    if (halt!=1){
    sctr++;
    if (sctr>number_of_sponsors-1){
    sctr=0;
    }
    document.sponsor.src=isn[sctr].src;
    setTimeout("rotateIt()",30000);
    }
    }

    /* This code will work just fine with or without
    frames. However, if you are in frames and wish
    to replicate the TARGET="_top" call to remove
    frames, change the location.href call to:
    parent.location.href=durl[sctr];
    below. */
    function doIt(){
    halt=1;
    location.href = durl[sctr];
    parent

    }

    function dispIt(){
    parent.window.status=durl[sctr];
    }
    // End Hiding -->
    </SCRIPT>
    </HEAD>
    <BODY BGCOLOR="darkred">

    <!-- You may wish to have content here above the rotating
    sponsor banner. In the table below, you will need to
    insert the filename for the any .gif or .jpg that
    you wish displayed on the page. If you are using
    different height and width images, don't forget to
    change those values, as well. -->

    <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>
    <TR><TD><A HREF="npgspo.htm" onClick="doIt();return false" onMouseover="dispIt();return true;">
    <IMG SRC="g/webw.gif" HEIGHT=72 WIDTH=236 NAME="sponsor" BORDER=0></TD></TR>
    </TABLE>

    <!-- Or, you may wish to have content appear here below
    the rotating sponsor banners.

    IMPORTANT!!! - This little script below is necessary
    right at the bottom of your HTML to begin the sponsor
    banner rotation: -->
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Hide JavaScript from Java-Impaired Browsers
    sctr=0;
    rotateIt();
    // End Hiding -->
    </SCRIPT>
    There are 4 frames

    -------------------------------
    - Menu- Main Area -
    - - -
    - - -


    and then later down
    Main Area
    - -------------------------
    - Menu - Ad Bar | Juke Box -

    The drawing is messed up but if I had an ad in the adbar frame and I wanted to make it change the page in the frame named main how would I change the code
    location.href = durl[sctr];
    to navigate in that frame instead of in the same frame it is in or a new page. I know the changing it to parent.location.href = durl[sctr]; makes it appear outside of all frames but I want it to just appear in a different frame.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    3
    Rep Power
    0
    Yep, I was right, it did mess up the drawing. It appears right in the text box but it stretches it out when it actually appears on the message board.

Similar Threads

  1. Javascript / frame problem
    By ccsf4cg in forum JavaScript Development
    Replies: 0
    Last Post: November 23rd, 2003, 08:56 PM
  2. jump to swf frame using javascript onload
    By gstiehl in forum JavaScript Development
    Replies: 2
    Last Post: July 2nd, 2003, 10:32 AM
  3. Forcing a frame size (dynamically - with JavaScript??)
    By DEfusion in forum JavaScript Development
    Replies: 0
    Last Post: June 20th, 2003, 11:25 AM
  4. Refresh a frame without javascript
    By robbrown in forum JavaScript Development
    Replies: 6
    Last Post: August 22nd, 2002, 06:36 PM
  5. Replies: 0
    Last Post: February 28th, 2002, 03:12 PM

IMN logo majestic logo threadwatch logo seochat tools logo