Javascript change div content upon a click

后端 未结 3 1770
花落未央
花落未央 2021-01-25 03:30

I\'m pulling a content from PHP array and I have a situation like this:

 
04/25/2011 10
3条回答
  •  执念已碎
    2021-01-25 04:13

    How about something like:

    onClick event calls a function (EDITED to be a little smarter than my original brute force method):

    function swapdivs ( id_of_topdiv, id_of_bottomdiv ) {
      var topdiv    = getRefToDiv( id_of_topdiv );
      var bottomdiv = getRefToDiv( id_of_bottomdiv );
    
      var temp  = topdiv.style.zIndex;
      topdiv    = bottomdiv.style.zIndex;
      bottomdiv = temp.style.zIndex;
    }
    

    Could that or similar work for you? Or am I missing some subtle yet crucial requirement?

提交回复
热议问题