Note that there are some explanatory texts on larger screens.

plurals
  1. POOne button, changing ID for drawing
    primarykey
    data
    text
    <p>I try to make a line graph in Canvas, I had a main.html and script in main.js (dosen`t matter what is inside - I will paste only the end of the code).</p> <p>This is the end of main.js - plot,plot2,plot3 is a function to draw a line.</p> <pre><code>document.getElementById("button").onclick = plot; ///drawing line 1 document.getElementById("button2").onclick = plot2; //drawing line 2 document.getElementById("button3").onclick = plot3; //drawing line 3 document.getElementById("button4").onclick = plot4; //drawing .... document.getElementById("button5").onclick = plot5; //drawing ... </code></pre> <p>In main.html i had </p> <pre><code> &lt;input type="submit" name="button" id="button" value="Rysuj" /&gt;&lt;/td&gt; &lt;input type="submit" name="button2" id="button2" value="Rysuj2" /&gt;&lt;/td&gt; &lt;input type="submit" name="button3" id="button3" value="Rysuj3" /&gt;&lt;/td&gt; &lt;input type="submit" name="button4" id="button4" value="Rysuj4" /&gt;&lt;/td&gt; &lt;input type="submit" name="button5" id="button5" value="Rysuj5" /&gt;&lt;/td&gt; </code></pre> <p>And when I press buttons Rysuj, Rysuj2, Rysuj3 all are drawing.</p> <p>But i would like to make just 1 button like a 'Rysuj' and i try to change a ID after click but something dosn`t work.</p> <p>In main.html I wrote:</p> <pre><code> &lt;script language="text/javascript"&gt; function something(){ document.getElementById("button").id = "button2" } &lt;/script&gt; &lt;input type="button" onclick="something()" value="Rysuj" id="button"&gt; </code></pre> <p>What i should do to Make just a 1 Button which after click will change ID to button2, after next click to button3 etc ? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload