Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Code Help

  1. #1
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    Please Help

    1 dollar offer will get you onto the Top 10 richest list

    Code:
    totalsites = 0;
    totalgraphics = 'graphics.length';
    totalother = 0;
    
    wstartsel = 0;
    gstartsel = 0;
    ostartsel = 0;
    
    currenttype = 'none';
    
    var graphics = new Array(totalgraphics)
    graphics[0] = "comingsoon01.gif";
    graphics[1] = "logo01.gif";
    graphics[2] = "logo02.gif";
    
    function selecttype(newtype) {
    if (newtype == 'graphicsel') document.examplepic.src = graphics[gstartsel];
    currenttype = newtype;
    }
    
    function exampleswap(direction) {
    if (currenttype == 'graphicsel') {
    gstartsel = gstartsel + direction;
    if (gstartsel > totalgraphics - 1) gstartsel = 0
    else if (gstartsel < totalgraphics - totalgraphics) gstartsel = totalgraphics;
    graphicsswap = graphics[gstartsel];
    document.examplepic.src = graphicsswap;
    }
    JR

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    What's the problem?
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    it doesn't say, it just has an error on the page the it doesn't work...

    it works without the function exampleswap on the page but then it doesnt work at all
    JR

  5. #4
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Open the page in Mozilla, do whatever causes the error, then type "javascript:" in the location bar and press Enter.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  6. #5
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    thanks i nailed one of the errors, is there anywhere online to check javascript errors like dr. html?
    JR

  7. #6
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    yes the one error i sorted fixed the lot ...

    i didnt put a curly bracket around the last function
    JR

  8. #7
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    is this the right way to do this...?
    Code:
    var other = new Array(totalother)
    other[0] = "<a href=javascript(otherdisp, 0)><img src=\"images/examples/none.gif\"></a>";
    other[1] = "<a href=javascript(otherdisp, 1)><img src=\"images/examples/nonealt.gif\"></a>";
    thanks
    JR

  9. #8
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    ok i found that does work finally

    but now the problem is this....
    a href=javascript('otherdisp', 1)

    how do i do 2 variables in 1 function?
    JR

  10. #9
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    You're forgetting the quotes in the href.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  11. #10
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    ah i thought i had to drop the quotes, as you told me in another thread, i will try this now
    JR


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:33 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com