36 users online (2 members and 34 guests)  


  Results 1 to 12 of 12

Related

  1. What is wrong with this code    Forum: CSS Forum
    Replies: 4
  2. Replies: 3
  3. What is wrong with this code?    Forum: HTML Forum
    Replies: 1
  4. What is wrong with this code??    Forum: HTML Forum
    Replies: 0
  5. What's wrong with this?    Forum: HTML Forum
    Replies: 5
  1. #1
    Silly-Girl's Avatar
    New User

    Status
    Offline
    Join Date
    May 2003
    Location
    Michigan
    Posts
    13

    What is wrong with this code??

    I have tried and tried to get this to work! I want this image to change everyday, I have 7 preloaded images but it keeps cycling thru them like a regular animation. I have given myself a headache trying to figure this out!! Silly-girl

    <html>
    <head>
    <title>Untitled</title>

    <!-- JavaScript Banner Rotator - Rotate banners in order after a set period of time.
    <!-- Text automatically created by Banner Maker Pro www.bannermakerpro.com-->
    <!-- Put this text in the HEAD section of the HTML -->

    <script language="JavaScript">
    <!--
    var AdNum = 0;

    function initArray() {
    this.length = initArray.arguments.length;
    for (var i = 0; i < this.length; i++) {
    this[i] = initArray.arguments[i];
    }
    }

    links = new initArray(
    )


    images = new initArray(
    )


    alttext = new initArray(
    )

    // -->
    </script>
    <!-- End Banner Rotator HEAD Code -->
    </head>

    <body>




    <!-- JavaScript Banner Rotator - Rotate banners in order after a set period of time.
    <!-- Text automatically created by Banner Maker Pro www.bannermakerpro.com-->
    <!-- Put this text in the BODY section of the HTML -->

    <script language="JavaScript">
    <!--
    var bannerlink = ""
    function rotatebanners() {
    if (AdNum == 1) {
    AdNum = 0
    }
    document.BannerAd.src=images[AdNum]
    document.BannerAd.alt=alttext[AdNum]
    setTimeout("rotatebanners()",*1000,*60,*60,*24)
    bannerlink = links[AdNum]
    AdNum++
    }

    function changelink() {
    location = bannerlink
    }
    // -->
    </script>

    <a href='javascript:changelink()'><img src="http://groups.msn.com/_Secure/0UgAAAGsYTPZD6z9qUuEN11!o2efpgxVUX4TiM10Jfc6B4yf*MxoqVyXAU6i1OXcxDXf3tjGeK2YIhI1fQBX!8Qs*FE4iRdrag8T7cBTY0Q30B4FnSi5NINPle9Fo8GDM/bhouseani%28c%29.gif?dc=4675421635144269082" name="BannerAd" alt=""width="262" height="333" ></a>

    <script language="JavaScript">
    rotatebanners();
    </script>
    <!-- End Banner Rotator BODY Code -->


    </body>
    </html>

  2. #2
    Doorknob's Avatar
    Super Newbie

    Status
    Offline
    Join Date
    Jun 2002
    Location
    Malaysia
    Posts
    316
    just replace tip with the image url
    for example
    msg[2] = "<img src='image.jpg'>"

    then put "writeTip()" into wherever it is u want the image to display, for example, in a table. hope that helps

    *********begin code*********
    var msg = new Array();
    Stamp = new Date();
    today = Stamp.getDate();
    msg[1] = "Tip 1";
    msg[2] = "Tip 2";
    msg[3] = "Tip 3";
    msg[4] = "Tip 4";
    msg[5] = "Tip 5";
    msg[6] = "Tip 6";
    msg[7] = "Tip 7";
    msg[8] = "Tip 8";
    msg[9] = "Tip 9";
    msg[10] = "Tip 10";
    msg[11] = "Tip 11";
    msg[12] = "Tip 12";
    msg[13] = "Tip 13";
    msg[14] = "Tip 14";
    msg[15] = "Tip 15";
    msg[16] = "Tip 16";
    msg[17] = "Tip 17";
    msg[18] = "Tip 18";
    msg[19] = "Tip 19";
    msg[20] = "Tip 20";
    msg[21] = "Tip 21";
    msg[22] = "Tip 22";
    msg[23] = "Tip 23";
    msg[24] = "Tip 24";
    msg[25] = "Tip 25";
    msg[26] = "Tip 26";
    msg[27] = "Tip 27";
    msg[28] = "Tip 28";
    msg[29] = "Tip 29";
    msg[30] = "Tip 30";
    msg[31] = "Tip 31";

    function writeTip() {
    document.write(msg[today]);
    *********end code*********

  3. #3
    Silly-Girl's Avatar
    New User

    Status
    Offline
    Join Date
    May 2003
    Location
    Michigan
    Posts
    13
    Doorknob, although I apperciate the answer... I have not a clue as to what you are talking about? Silly-girl

  4. #4
    Doorknob's Avatar
    Super Newbie

    Status
    Offline
    Join Date
    Jun 2002
    Location
    Malaysia
    Posts
    316
    this is how its used
    hope that helps

    ***************************************
    <html>
    <head>
    <script language=Javascript>
    <!--

    var msg = new Array();
    Stamp = new Date();
    today = Stamp.getDate();
    msg[1] = "<img src='imgurl.jpg'>";
    msg[2] = "<img src='imgurl.jpg'>";
    msg[3] = "<img src='imgurl.jpg'>";
    blah blah
    msg[28] = "<img src='imgurl.jpg'>";
    msg[29] = "<img src='imgurl.jpg'>";
    msg[30] = "<img src='imgurl.jpg'>";
    msg[31] = "<img src='imgurl.jpg'>";

    function writeTip() {
    document.write(msg[today]);
    -->
    </script>
    </head>
    <body onLoad='writetip()'>
    </body>
    </html>
    ***************************************

  5. #5
    Silly-Girl's Avatar
    New User

    Status
    Offline
    Join Date
    May 2003
    Location
    Michigan
    Posts
    13
    Darn! That is not working either, I keep getting script errors, about object expected, and '}' ? Silly- girl

  6. #6
    Enigma's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Nov 2000
    Posts
    426
    Can you post the URL of the page where you're testing?

  7. #7
    benzden's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2002
    Location
    San Antonio, Texas
    Posts
    652
    Use the search and replace function of your editor to count the left { and right } curley brackets to make sure they match.

  8. #8
    Silly-Girl's Avatar
    New User

    Status
    Offline
    Join Date
    May 2003
    Location
    Michigan
    Posts
    13
    http://www.haleyshaven.com/anibird.html

    Here is the page, it is blank, but you can look at the source. Silly-girl

  9. #9
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    Though I am no JS pro, I do not think this is proper
    Code:
    '}'
    try removing the ' '

    Dave
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting

  10. #10
    Silly-Girl's Avatar
    New User

    Status
    Offline
    Join Date
    May 2003
    Location
    Michigan
    Posts
    13
    Dave, thank you, I tried your suggestion but it didnt work, I did however try to modify it and put the brackets around the entire function code, and it cleared up that error, but I am getting another one (grrrrrr), it says that it is
    Line 20
    Char 4
    Error Expected (the character it depicts is a smiley face with
    2 lines going up and down for eyes, a nose that is at the bottom of the eyes.. and a diag slash to the left for the mouth)
    Hope you can get it from the description. I have worked and cleared up the other errors.
    Just want to say, that you all have been a godsend to someone who is just learning... Thank you for your patience!!
    Silly-girl

  11. #11
    benzden's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2002
    Location
    San Antonio, Texas
    Posts
    652
    Try this instead of what's there now:
    ...
    function writeTip() { document.write(msg[today]); }
    //-->
    </script>

  12. #12
    nuffsaid420's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2003
    Posts
    7
    Well I took a look at this and tried to get it to work, I hope this helps:

    <head>
    <title>Ani bird</title>
    <SCRIPT type=text/javascript>
    <!--
    var msg = new Array();
    Stamp = new Date();
    today = Stamp.getDate();
    msg[1] = newImage("images/templateover1_10.gif");
    msg[2] = newImage("images/templateover1_10.gif");
    msg[3] = newImage("images/templateover1_10.gif");

    msg[4] = newImage("images/templateover1_10.gif");
    msg[5] = newImage("images/templateover1_10.gif");
    msg[6] = newImage("images/templateover1_10.gif");
    msg[7] = newImage("images/templateover1_10.gif");

    function writeTip()
    {
    document.write(msg[today]);
    }

    //-->
    </SCRIPT>
    </head>
    <body onLoad=writeTip();>



    </body>
    </html>


    change the image files back, it's giving me an undefined error, which is your msg= Array I don't think it is an array. But I am not good a js so maybe someone else can fix that and it should work.



Tags for this Thread