javascript - Onclick jquery function wont work -


So at the bottom I have an example of a Bela and my code below, currently, the problem I am facing That is when I try to allocate a function variable on click, the function does not execute. I want to enable input numbers in the input field and click to be able to click and it is to generate a new wave ground on click. HTML

  & lt; Div id = "container" & gt; Any help is appreciated! & Lt; Div id = "wave" & gt; & Lt; / Div & gt; & Lt; Div id = "wavelength-text" class = "text" & gt; Wavelength & lt; / Div & gt; & Lt; Div id = "dimension-text" class = "text" & gt; Ayyavity & lt; / Div & gt; & Lt; Br / & gt; & Lt; Input type = "text" value = "50" id = "wavelength" & gt; & Lt; / Input & gt; & Lt; Input type = "text" value = "50" id = "dimension" & gt; & Lt; / Input & gt; & Lt; Div id = "button" & gt; & Lt; Button & gt; Generated & lt; / Button & gt; & Lt; / Div & gt; & Lt; / Div & gt; Wavelength = 50, dimension = 50, step = 90, width = 500, color = "# / strong>   FFF ", thickness = 3; var height = 220; Var canvas = document.createElement ("canvas"); Canvas Width = width; Canvas High = height; $ ("# Wave") enclosed (canvas). // get context var ctx = canvas.getContext ('2d'); Ctx.clearRect (0, 0, canvas wide, canvas.height); Ctx.strokeStyle = color; Ctx.lineWidth = thickness; Step = Step * Math PI / 180; Var amp = dimension - thickness / 2; Var Freak = 2 * Math PI * (1 / wavelength); Var yOrigin = height / 2; Var y1, y2; Ctx.beginPath (); (Var i = 0; i & lt; width; i ++) for {y1 = amp * math (Phase + freq * i) + yOrigin; Y2 = amp * Math.sin (step + freq * (i + 1)) + yOrigin; Ctx.moveTo (i, y1); Ctx.lineTo (i + 1, y2); } CTX. Stroke ();    

I have decided your bell, so this will work:

Here is the html:

  & lt; Div id = "container" & gt; & Lt; Div id = "wave" & gt; & Lt; / Div & gt; & Lt; Div id = "wavelength-text" class = "text" & gt; Wavelength & lt; / Div & gt; & Lt; Div id = "dimension-text" class = "text" & gt; Ayyavity & lt; / Div & gt; & Lt; Br / & gt; & Lt; Input type = "text" value = "50" id = "wavelength" & gt; & Lt; / Input & gt; & Lt; Input type = "text" value = "50" id = "dimension" & gt; & Lt; / Input & gt; & Lt; Div id = "button" onclick = "generFrame ()" & gt; & Gt; Button & gt; Generated & lt; / Button & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

Here's the JS:

  function generatedframe () {$ ("# wave"). Lesson (''); Var wavelength = document. GetElementById ('wavelength'). value; Var importability = document. GetElementById ('dimension'). value; Var phase = 90, width = 500, color = "#FFF", thickness = 3; Var height = 220; Var canvas = document.createElement ("canvas"); Canvas Width = width; Canvas High = height; $ ("# Wave") enclosed (canvas). // get context var ctx = canvas.getContext ('2d'); Ctx.clearRect (0, 0, canvas wide, canvas.height); Ctx.strokeStyle = color; Ctx.lineWidth = thickness; Step = Step * Math PI / 180; Var amp = dimension - thickness / 2; Var Freak = 2 * Math PI * (1 / wavelength); Var yOrigin = height / 2; Var y1, y2; Ctx.beginPath (); (Var i = 0; i & lt; width; i ++) for {y1 = amp * math (Phase + freq * i) + yOrigin; Y2 = amp * Math.sin (step + freq * (i + 1)) + yOrigin; Ctx.moveTo (i, y1); Ctx.lineTo (i + 1, y2); } CTX. Stroke (); }    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -