www.webdeveloper.com
Results 1 to 2 of 2

Thread: Need to make a flag reset with an onclick procedure

  1. #1
    Join Date
    Oct 2009
    Posts
    15

    Need to make a flag reset with an onclick procedure

    Title probably isn't really what I need to do. But here is what I need to do.

    With the current set up I have, when you hover over a thumbnail, it puts a larger preview image to the right. When you mouseout it goes to the next one or away. However, when you click it is supposed to stick there.

    Unfortunately I am not doing it right for the functionality I want.

    Here is the functions that deal with the mouseover, out, and onclick
    PS how can I make this an external file?
    <code>
    <script type="text/javascript">
    /*These are the thumbnail rollover controllers*/
    var flag = 0;

    function rollOver(prevID) {
    return document.getElementById(prevID).style.display = 'block';
    }
    function rollOut(prevID) {
    if(flag == 0) {
    return document.getElementById(prevID).style.display = 'none';
    }
    }
    function stick(prevID, itemNum) {
    return flag = 1;
    return document.getElementById(prevID).style.display = 'block';
    return document.getElementById(itemNum).style.display = 'block';

    }
    </script></code>
    Also I know that the flag is being returned as 1 and that is why it's doing what its doing, I just don't know any other way to do it so that it does what I want.

    If you need anymore code let me know and I'll post it asap.

    Thanks in advance!

  2. #2
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    You don't need, or want, all those returns
    Code:
    var flag = 0;
    function rollOver(prevID) {
      document.getElementById(prevID).style.display = 'block';
    }
    function rollOut(prevID) {
      if(flag == 0) {
        document.getElementById(prevID).style.display = 'none';
      }
    }
    function stick(prevID, itemNum) {
      flag = 1;
      document.getElementById(prevID).style.display = 'block';
    //  document.getElementById(itemNum).style.display = 'block';  // ???
    }

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