How to write a condition: if the cursor over the desired item and the right mouse button is pressed. Code:

if (незнаю что здесь писать && e.button == "2"){ ... } 

    3 answers 3

    Then it’s better to put it this way: <button onmousedown="alert('Хелоу!')">нажми</button>

    • I just need the condition of the form: if (don `t know what to write here && e.button ==" 2 ") {...} - shol

    Write there verification e.target. Type e.target.id == 'id15' .

    • I did not understand the odd - shol
    • And what is not understood? - ling
     elem.onmouseover = elemOver; elem.onmouseout = elemOut; function elemOver() { this.over = true; //мышка над нужным еллементом } function elemOut() { this.over = false; //уже нет } 

    Well, then I think you figure it out yourself :)

    • elem for what? and no, you just need a condition - shol
    • Fir tree is your element, well, ok, I would also be interested to see the solution in the 1st condition, but something is hard to believe that there is such a thing - Zowie