SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    May 2001
    Location
    London
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's my problem....

    Basically, if you go to the following page:

    www.foodandkarate.com/sfspage.html

    you will see a list of songs for sale that change when you select from
    the three different categories on the left hand side.

    Essentially for the song lists, I'm using nine spaces, each of which
    holds a different image triggered by a function that calls on arrays
    that are referenced from the category selection that I mentioned
    above. this works.

    When I pass the mouse over one of the songs, I want the user to be able
    to click and play the song. That means that like the images, the href
    must also change for each space as the different categories are
    selected.


    here's the code I'm using for each space (space 1 as an example):

    <div style="position: absolute; top: 178px; left: 294px">
    <a href="javascript: changelink1()"
    onMouseOver="changespace1()">
    <img src="buttons/sfsbutkg.jpg" NAME="pic11" width="168" height="19"
    border="0"
    alt=""></a>
    </div>

    And here's the code for the two functions referenced in the above
    section:

    function changelink1() {
    link=link1[num1]
    }


    and

    function changespace1() {

    document.pic11.src=space1[altnum]
    document.pic12.src=space2[num1]
    document.pic13.src=space3[num1]
    document.pic14.src=space4[num1]
    document.pic15.src=space5[num1]
    document.pic16.src=space6[num1]
    document.pic17.src=space7[num1]
    document.pic18.src=space8[num1]
    document.pic19.src=space9[num1]
    }

    I'm sure I'm doing something stupid coding-wise.

    If it's not to much trouble, could you take a quick look?

    Thanks,

    Brad

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this function:

    <script language="JavaScript">
    <!--

    function randomImage() {
    pic = new Array();
    hexColor = new Array();
    pic[0] = 'images/hdr_green.jpg';
    pic[1] = 'images/hdr_purple.jpg';
    pic[2] = 'images/hdr_yellow.jpg';
    pic[3] = 'images/hdr_blue.jpg';
    hexColor[0] = '#83C463';
    hexColor[1] = '#BA63C4';
    hexColor[2] = '#FFE167';
    hexColor[3] = '#6395C6';
    randomNum = Math.floor(Math.random()*pic.length);
    newImage = pic[randomNum];
    newHex = hexColor[randomNum];
    }

    // -->
    </script>

    I gives a different random number each time the page is loaded. Then you grab the random number and assign it to any action you want. You can see the results here:
    www.gravitydigital.com/cvb.

    You could easily change this function to get what you need. If I understand you correctly that is.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes


Bookmarks

Posting Permissions

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