www.webdeveloper.com
Results 1 to 2 of 2

Thread: Syntax help! Need help changing two divs on one mouseclick.

  1. #1
    Join Date
    Nov 2011
    Posts
    6

    Syntax help! Need help changing two divs on one mouseclick.

    Sorry for the vague title, I'm very new at this! This is my second post on this forum; the first was very successful.

    I have a link, which will hopefully change two divs simultaneously.

    At the moment, I can only get one div to work at a time:

    HTML Code:
    <a href="#" onClick="changeDetails(0);">LINK</a>
    
    <a href="#" onClick="documentGetElementById('bgimg').src='img/00.jpg'">LINK</a>
    How would I combine these so the div and the image changes?

    The JS looks like this:

    Code:
    function changeDetails (num) {
    document.getElementById("details1").innerHTML = anArray[num];
    }
    I hope this is clear enough. Thanks!

  2. #2
    Join Date
    Nov 2011
    Posts
    6
    Sorry, I was too quick to make this thread. Solution is here for anyone who ended up here with the same Q:

    HTML Code:
    <a href="#" onClick="changeDetails(0), document.getElementById('bgimg').src='img/00.jpg'">LINK</a>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles