Jump to content

Chogori

Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Chogori

  • Rank
    Newbie

Profile Information

  • Gender
    Male
  1. Hi, can somebody help me with the following task? I am trying to make a gallery with small "preview" pictures, which are in form of background-images. After the click on one of these small pictures, i want to display a "window" (<div> actually) with full-sized picture. Everything works fine. But afterthat, i want to insert "<" and ">" symbols for switching on previous/next picture to my <div> "window". I tried different ways, but without success. I have no idea how to get index of active "smallImages", tj. img, whose url is now src of "largeImg". (btw. I have to convert "sm
  2. And what is the best solution? Make currentTD global and then wrap whole script in function? Like this? https://jsfiddle.net/4odhrgLL/3/ Sorry for (maybe) stupid questions, I am JS newbie
  3. I am trying to write a script, which: • after the click on any <td> cell makes <div id="pole"> visible • after the click on one of the <li> from <div id="pole> take the content of this li and insert it to <td> cell, which onclick makes <div> visible AND change <div> visibility back to "hidden" Everything works almost fine. Almost... For example: 1) I click on some <td> cell and then choose <li> "strength" - that´s ok, "strength" is written to that cell 2) After that I click on another cell and choose <li> "endurance" - "enduran
  4. Ingolme, thanks, you are absolutly right!
  5. Can somebody explain me, why is necessary to write: childTD[i].addEventListener("click", function(){changeColor(this);}); and not just: childTD[i].addEventListener("click", changeColor(this)); Here is the whole code: var ParentTable = document.getElementById("mytable");var childTD = ParentTable.getElementsByTagName("td");for(i=0;i<childTD.length;i++) { childTD[i].addEventListener("click", function(){changeColor(this);});}function changeColor(element) { element.style.backgroundColor="red";} Thanks a lot!
×
×
  • Create New...