Results 1 to 6 of 6

Thread: Script Not Working

  1. #1
    Join Date
    Jun 2009
    Posts
    62
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default Script Not Working

    Check out this page on my site: http://www.onestopplay.com/musicvideos/
    Now check out the source code. It supposed to be so that when you click on a link a certain div pops up in the "ARTISTS/SONGS" section.
    Can anyone figure out why it isn't working??
    THANKS!

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    You may have to work with it - but give this a try:
    http://www.dynamicdrive.com/forums/s...2&postcount=19
    Jeremy | jfein.net

  3. #3
    Join Date
    Jun 2009
    Posts
    62
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default

    That's way to confusing for me. Does anyone know what is wrong with my code? It used to work...then I don't know what happened.
    Thanks Nile for the quick reply.

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    All you need to do is insert this:
    Code:
    <script type="text/javascript">
    function getID(me) {
    	var values = document.getElementById("getValues").getElementsByTagName("div");
    	for(var i = 0; i < values.length; i++){
    		if(values[i].getAttribute("class") == me.getAttribute("id")){
    			values[i].style.display = "block";
    		} else {
    			values[i].style.display = "none";
    		}
    	}
    }  
    </script>
    In the head part of you're document, and on every link you have, make the ID equal to the class of which div's you want to appear.





    One of you're problems is on line 2101:
    Code:
    }}
    Remove the highlighted.

    Tell me how that works out.
    Jeremy | jfein.net

  5. #5
    Join Date
    Jun 2009
    Posts
    62
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default

    I think I would really like to stay away from that method unless you can give me at least a little bit of an example for my site.

    I got rid of that }. It works ... to an extent. Now when I click a song name, the video pops up (thankfully). But clicking on an artist or letter still doesn't work. Can anyone see any more errors?

  6. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Code:
    id is not defined
    http://www.onestopplay.com/musicvideos/
    Line 145
    Meaning "id" is not a variable (since the function is over). At the top of your code put:
    Code:
    var ida = "";
    Then here:
    Code:
    function changeMenu(id) {
    Add
    Code:
    ida = id;
    Under function cha...() {

    Then every "id" under line 145 should be "ida" instead.
    Jeremy | jfein.net

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
  •